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

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

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

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::index
* @see app/Http/Controllers/Api/V1/JobcardController.php:13
* @route '/api/v1/jobcards'
*/
const indexForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::index
* @see app/Http/Controllers/Api/V1/JobcardController.php:13
* @route '/api/v1/jobcards'
*/
indexForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

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

index.form = indexForm

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::store
* @see app/Http/Controllers/Api/V1/JobcardController.php:55
* @route '/api/v1/jobcards'
*/
export const store = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::store
* @see app/Http/Controllers/Api/V1/JobcardController.php:55
* @route '/api/v1/jobcards'
*/
store.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::store
* @see app/Http/Controllers/Api/V1/JobcardController.php:55
* @route '/api/v1/jobcards'
*/
const storeForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: store.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::store
* @see app/Http/Controllers/Api/V1/JobcardController.php:55
* @route '/api/v1/jobcards'
*/
storeForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: store.url(options),
    method: 'post',
})

store.form = storeForm

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::show
* @see app/Http/Controllers/Api/V1/JobcardController.php:39
* @route '/api/v1/jobcards/{jobcard}'
*/
export const show = (args: { jobcard: string | number } | [jobcard: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

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

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::show
* @see app/Http/Controllers/Api/V1/JobcardController.php:39
* @route '/api/v1/jobcards/{jobcard}'
*/
show.url = (args: { jobcard: string | number } | [jobcard: string | number ] | string | number, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { jobcard: args }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
        jobcard: args.jobcard,
    }

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

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::show
* @see app/Http/Controllers/Api/V1/JobcardController.php:39
* @route '/api/v1/jobcards/{jobcard}'
*/
show.get = (args: { jobcard: string | number } | [jobcard: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::show
* @see app/Http/Controllers/Api/V1/JobcardController.php:39
* @route '/api/v1/jobcards/{jobcard}'
*/
show.head = (args: { jobcard: string | number } | [jobcard: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: show.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::show
* @see app/Http/Controllers/Api/V1/JobcardController.php:39
* @route '/api/v1/jobcards/{jobcard}'
*/
const showForm = (args: { jobcard: string | number } | [jobcard: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::show
* @see app/Http/Controllers/Api/V1/JobcardController.php:39
* @route '/api/v1/jobcards/{jobcard}'
*/
showForm.get = (args: { jobcard: string | number } | [jobcard: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::show
* @see app/Http/Controllers/Api/V1/JobcardController.php:39
* @route '/api/v1/jobcards/{jobcard}'
*/
showForm.head = (args: { jobcard: string | number } | [jobcard: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

show.form = showForm

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::update
* @see app/Http/Controllers/Api/V1/JobcardController.php:88
* @route '/api/v1/jobcards/{jobcard}'
*/
export const update = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: update.url(args, options),
    method: 'patch',
})

update.definition = {
    methods: ["patch"],
    url: '/api/v1/jobcards/{jobcard}',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::update
* @see app/Http/Controllers/Api/V1/JobcardController.php:88
* @route '/api/v1/jobcards/{jobcard}'
*/
update.url = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { jobcard: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::update
* @see app/Http/Controllers/Api/V1/JobcardController.php:88
* @route '/api/v1/jobcards/{jobcard}'
*/
update.patch = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: update.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::update
* @see app/Http/Controllers/Api/V1/JobcardController.php:88
* @route '/api/v1/jobcards/{jobcard}'
*/
const updateForm = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: update.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::update
* @see app/Http/Controllers/Api/V1/JobcardController.php:88
* @route '/api/v1/jobcards/{jobcard}'
*/
updateForm.patch = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: update.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

update.form = updateForm

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::destroy
* @see app/Http/Controllers/Api/V1/JobcardController.php:122
* @route '/api/v1/jobcards/{jobcard}'
*/
export const destroy = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroy.url(args, options),
    method: 'delete',
})

destroy.definition = {
    methods: ["delete"],
    url: '/api/v1/jobcards/{jobcard}',
} satisfies RouteDefinition<["delete"]>

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::destroy
* @see app/Http/Controllers/Api/V1/JobcardController.php:122
* @route '/api/v1/jobcards/{jobcard}'
*/
destroy.url = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { jobcard: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::destroy
* @see app/Http/Controllers/Api/V1/JobcardController.php:122
* @route '/api/v1/jobcards/{jobcard}'
*/
destroy.delete = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroy.url(args, options),
    method: 'delete',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::destroy
* @see app/Http/Controllers/Api/V1/JobcardController.php:122
* @route '/api/v1/jobcards/{jobcard}'
*/
const destroyForm = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: destroy.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'DELETE',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::destroy
* @see app/Http/Controllers/Api/V1/JobcardController.php:122
* @route '/api/v1/jobcards/{jobcard}'
*/
destroyForm.delete = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: destroy.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'DELETE',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

destroy.form = destroyForm

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::updateStatus
* @see app/Http/Controllers/Api/V1/JobcardController.php:130
* @route '/api/v1/jobcards/{jobcard}/status'
*/
export const updateStatus = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: updateStatus.url(args, options),
    method: 'patch',
})

updateStatus.definition = {
    methods: ["patch"],
    url: '/api/v1/jobcards/{jobcard}/status',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::updateStatus
* @see app/Http/Controllers/Api/V1/JobcardController.php:130
* @route '/api/v1/jobcards/{jobcard}/status'
*/
updateStatus.url = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { jobcard: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::updateStatus
* @see app/Http/Controllers/Api/V1/JobcardController.php:130
* @route '/api/v1/jobcards/{jobcard}/status'
*/
updateStatus.patch = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: updateStatus.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::updateStatus
* @see app/Http/Controllers/Api/V1/JobcardController.php:130
* @route '/api/v1/jobcards/{jobcard}/status'
*/
const updateStatusForm = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: updateStatus.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::updateStatus
* @see app/Http/Controllers/Api/V1/JobcardController.php:130
* @route '/api/v1/jobcards/{jobcard}/status'
*/
updateStatusForm.patch = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: updateStatus.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

updateStatus.form = updateStatusForm

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::convertTimeEntries
* @see app/Http/Controllers/Api/V1/JobcardController.php:145
* @route '/api/v1/jobcards/{jobcard}/time-entries/convert'
*/
export const convertTimeEntries = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: convertTimeEntries.url(args, options),
    method: 'post',
})

convertTimeEntries.definition = {
    methods: ["post"],
    url: '/api/v1/jobcards/{jobcard}/time-entries/convert',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::convertTimeEntries
* @see app/Http/Controllers/Api/V1/JobcardController.php:145
* @route '/api/v1/jobcards/{jobcard}/time-entries/convert'
*/
convertTimeEntries.url = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { jobcard: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::convertTimeEntries
* @see app/Http/Controllers/Api/V1/JobcardController.php:145
* @route '/api/v1/jobcards/{jobcard}/time-entries/convert'
*/
convertTimeEntries.post = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: convertTimeEntries.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::convertTimeEntries
* @see app/Http/Controllers/Api/V1/JobcardController.php:145
* @route '/api/v1/jobcards/{jobcard}/time-entries/convert'
*/
const convertTimeEntriesForm = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: convertTimeEntries.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobcardController::convertTimeEntries
* @see app/Http/Controllers/Api/V1/JobcardController.php:145
* @route '/api/v1/jobcards/{jobcard}/time-entries/convert'
*/
convertTimeEntriesForm.post = (args: { jobcard: string | number | { id: string | number } } | [jobcard: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: convertTimeEntries.url(args, options),
    method: 'post',
})

convertTimeEntries.form = convertTimeEntriesForm

const JobcardController = { index, store, show, update, destroy, updateStatus, convertTimeEntries }

export default JobcardController