import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../../../wayfinder'
/**
* @see \App\Http\Controllers\Api\V1\TrackingController::vehicles
* @see app/Http/Controllers/Api/V1/TrackingController.php:16
* @route '/api/v1/tracking/vehicles'
*/
export const vehicles = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: vehicles.url(options),
    method: 'get',
})

vehicles.definition = {
    methods: ["get","head"],
    url: '/api/v1/tracking/vehicles',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::vehicles
* @see app/Http/Controllers/Api/V1/TrackingController.php:16
* @route '/api/v1/tracking/vehicles'
*/
vehicles.url = (options?: RouteQueryOptions) => {
    return vehicles.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::vehicles
* @see app/Http/Controllers/Api/V1/TrackingController.php:16
* @route '/api/v1/tracking/vehicles'
*/
vehicles.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: vehicles.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::vehicles
* @see app/Http/Controllers/Api/V1/TrackingController.php:16
* @route '/api/v1/tracking/vehicles'
*/
vehicles.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: vehicles.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::vehicles
* @see app/Http/Controllers/Api/V1/TrackingController.php:16
* @route '/api/v1/tracking/vehicles'
*/
const vehiclesForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: vehicles.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::vehicles
* @see app/Http/Controllers/Api/V1/TrackingController.php:16
* @route '/api/v1/tracking/vehicles'
*/
vehiclesForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: vehicles.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::vehicles
* @see app/Http/Controllers/Api/V1/TrackingController.php:16
* @route '/api/v1/tracking/vehicles'
*/
vehiclesForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: vehicles.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

vehicles.form = vehiclesForm

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::storeVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:25
* @route '/api/v1/tracking/vehicles'
*/
export const storeVehicle = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: storeVehicle.url(options),
    method: 'post',
})

storeVehicle.definition = {
    methods: ["post"],
    url: '/api/v1/tracking/vehicles',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::storeVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:25
* @route '/api/v1/tracking/vehicles'
*/
storeVehicle.url = (options?: RouteQueryOptions) => {
    return storeVehicle.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::storeVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:25
* @route '/api/v1/tracking/vehicles'
*/
storeVehicle.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: storeVehicle.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::storeVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:25
* @route '/api/v1/tracking/vehicles'
*/
const storeVehicleForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: storeVehicle.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::storeVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:25
* @route '/api/v1/tracking/vehicles'
*/
storeVehicleForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: storeVehicle.url(options),
    method: 'post',
})

storeVehicle.form = storeVehicleForm

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::updateVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:43
* @route '/api/v1/tracking/vehicles/{vehicle}'
*/
export const updateVehicle = (args: { vehicle: string | number | { id: string | number } } | [vehicle: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: updateVehicle.url(args, options),
    method: 'patch',
})

updateVehicle.definition = {
    methods: ["patch"],
    url: '/api/v1/tracking/vehicles/{vehicle}',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::updateVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:43
* @route '/api/v1/tracking/vehicles/{vehicle}'
*/
updateVehicle.url = (args: { vehicle: string | number | { id: string | number } } | [vehicle: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { vehicle: args }
    }

    if (typeof args === 'object' && !Array.isArray(args) && 'id' in args) {
        args = { vehicle: args.id }
    }

    if (Array.isArray(args)) {
        args = {
            vehicle: args[0],
        }
    }

    args = applyUrlDefaults(args)

    const parsedArgs = {
        vehicle: typeof args.vehicle === 'object'
        ? args.vehicle.id
        : args.vehicle,
    }

    return updateVehicle.definition.url
            .replace('{vehicle}', parsedArgs.vehicle.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::updateVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:43
* @route '/api/v1/tracking/vehicles/{vehicle}'
*/
updateVehicle.patch = (args: { vehicle: string | number | { id: string | number } } | [vehicle: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: updateVehicle.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::updateVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:43
* @route '/api/v1/tracking/vehicles/{vehicle}'
*/
const updateVehicleForm = (args: { vehicle: string | number | { id: string | number } } | [vehicle: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: updateVehicle.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::updateVehicle
* @see app/Http/Controllers/Api/V1/TrackingController.php:43
* @route '/api/v1/tracking/vehicles/{vehicle}'
*/
updateVehicleForm.patch = (args: { vehicle: string | number | { id: string | number } } | [vehicle: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: updateVehicle.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

updateVehicle.form = updateVehicleForm

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::latest
* @see app/Http/Controllers/Api/V1/TrackingController.php:59
* @route '/api/v1/tracking/pings/latest'
*/
export const latest = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: latest.url(options),
    method: 'get',
})

latest.definition = {
    methods: ["get","head"],
    url: '/api/v1/tracking/pings/latest',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::latest
* @see app/Http/Controllers/Api/V1/TrackingController.php:59
* @route '/api/v1/tracking/pings/latest'
*/
latest.url = (options?: RouteQueryOptions) => {
    return latest.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::latest
* @see app/Http/Controllers/Api/V1/TrackingController.php:59
* @route '/api/v1/tracking/pings/latest'
*/
latest.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: latest.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::latest
* @see app/Http/Controllers/Api/V1/TrackingController.php:59
* @route '/api/v1/tracking/pings/latest'
*/
latest.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: latest.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::latest
* @see app/Http/Controllers/Api/V1/TrackingController.php:59
* @route '/api/v1/tracking/pings/latest'
*/
const latestForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: latest.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::latest
* @see app/Http/Controllers/Api/V1/TrackingController.php:59
* @route '/api/v1/tracking/pings/latest'
*/
latestForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: latest.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::latest
* @see app/Http/Controllers/Api/V1/TrackingController.php:59
* @route '/api/v1/tracking/pings/latest'
*/
latestForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: latest.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

latest.form = latestForm

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::history
* @see app/Http/Controllers/Api/V1/TrackingController.php:71
* @route '/api/v1/tracking/pings/history'
*/
export const history = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: history.url(options),
    method: 'get',
})

history.definition = {
    methods: ["get","head"],
    url: '/api/v1/tracking/pings/history',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::history
* @see app/Http/Controllers/Api/V1/TrackingController.php:71
* @route '/api/v1/tracking/pings/history'
*/
history.url = (options?: RouteQueryOptions) => {
    return history.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::history
* @see app/Http/Controllers/Api/V1/TrackingController.php:71
* @route '/api/v1/tracking/pings/history'
*/
history.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: history.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::history
* @see app/Http/Controllers/Api/V1/TrackingController.php:71
* @route '/api/v1/tracking/pings/history'
*/
history.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: history.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::history
* @see app/Http/Controllers/Api/V1/TrackingController.php:71
* @route '/api/v1/tracking/pings/history'
*/
const historyForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: history.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::history
* @see app/Http/Controllers/Api/V1/TrackingController.php:71
* @route '/api/v1/tracking/pings/history'
*/
historyForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: history.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::history
* @see app/Http/Controllers/Api/V1/TrackingController.php:71
* @route '/api/v1/tracking/pings/history'
*/
historyForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: history.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

history.form = historyForm

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::ingest
* @see app/Http/Controllers/Api/V1/TrackingController.php:99
* @route '/api/v1/tracking/pings'
*/
export const ingest = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: ingest.url(options),
    method: 'post',
})

ingest.definition = {
    methods: ["post"],
    url: '/api/v1/tracking/pings',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::ingest
* @see app/Http/Controllers/Api/V1/TrackingController.php:99
* @route '/api/v1/tracking/pings'
*/
ingest.url = (options?: RouteQueryOptions) => {
    return ingest.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::ingest
* @see app/Http/Controllers/Api/V1/TrackingController.php:99
* @route '/api/v1/tracking/pings'
*/
ingest.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: ingest.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::ingest
* @see app/Http/Controllers/Api/V1/TrackingController.php:99
* @route '/api/v1/tracking/pings'
*/
const ingestForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: ingest.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\TrackingController::ingest
* @see app/Http/Controllers/Api/V1/TrackingController.php:99
* @route '/api/v1/tracking/pings'
*/
ingestForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: ingest.url(options),
    method: 'post',
})

ingest.form = ingestForm

const TrackingController = { vehicles, storeVehicle, updateVehicle, latest, history, ingest }

export default TrackingController