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

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

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

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

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

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::index
* @see app/Http/Controllers/Api/V1/JobQueryController.php:30
* @route '/api/v1/job-queries'
*/
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\JobQueryController::accept
* @see app/Http/Controllers/Api/V1/JobQueryController.php:55
* @route '/api/v1/job-queries/{query}/accept'
*/
export const accept = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: accept.url(args, options),
    method: 'post',
})

accept.definition = {
    methods: ["post"],
    url: '/api/v1/job-queries/{query}/accept',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::accept
* @see app/Http/Controllers/Api/V1/JobQueryController.php:55
* @route '/api/v1/job-queries/{query}/accept'
*/
accept.url = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { query: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::accept
* @see app/Http/Controllers/Api/V1/JobQueryController.php:55
* @route '/api/v1/job-queries/{query}/accept'
*/
accept.post = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: accept.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::accept
* @see app/Http/Controllers/Api/V1/JobQueryController.php:55
* @route '/api/v1/job-queries/{query}/accept'
*/
const acceptForm = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: accept.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::accept
* @see app/Http/Controllers/Api/V1/JobQueryController.php:55
* @route '/api/v1/job-queries/{query}/accept'
*/
acceptForm.post = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: accept.url(args, options),
    method: 'post',
})

accept.form = acceptForm

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::decline
* @see app/Http/Controllers/Api/V1/JobQueryController.php:82
* @route '/api/v1/job-queries/{query}/decline'
*/
export const decline = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: decline.url(args, options),
    method: 'post',
})

decline.definition = {
    methods: ["post"],
    url: '/api/v1/job-queries/{query}/decline',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::decline
* @see app/Http/Controllers/Api/V1/JobQueryController.php:82
* @route '/api/v1/job-queries/{query}/decline'
*/
decline.url = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { query: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::decline
* @see app/Http/Controllers/Api/V1/JobQueryController.php:82
* @route '/api/v1/job-queries/{query}/decline'
*/
decline.post = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: decline.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::decline
* @see app/Http/Controllers/Api/V1/JobQueryController.php:82
* @route '/api/v1/job-queries/{query}/decline'
*/
const declineForm = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: decline.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::decline
* @see app/Http/Controllers/Api/V1/JobQueryController.php:82
* @route '/api/v1/job-queries/{query}/decline'
*/
declineForm.post = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: decline.url(args, options),
    method: 'post',
})

decline.form = declineForm

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::convertToJobcard
* @see app/Http/Controllers/Api/V1/JobQueryController.php:109
* @route '/api/v1/job-queries/{query}/convert-to-jobcard'
*/
export const convertToJobcard = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: convertToJobcard.url(args, options),
    method: 'post',
})

convertToJobcard.definition = {
    methods: ["post"],
    url: '/api/v1/job-queries/{query}/convert-to-jobcard',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::convertToJobcard
* @see app/Http/Controllers/Api/V1/JobQueryController.php:109
* @route '/api/v1/job-queries/{query}/convert-to-jobcard'
*/
convertToJobcard.url = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { query: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::convertToJobcard
* @see app/Http/Controllers/Api/V1/JobQueryController.php:109
* @route '/api/v1/job-queries/{query}/convert-to-jobcard'
*/
convertToJobcard.post = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: convertToJobcard.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::convertToJobcard
* @see app/Http/Controllers/Api/V1/JobQueryController.php:109
* @route '/api/v1/job-queries/{query}/convert-to-jobcard'
*/
const convertToJobcardForm = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: convertToJobcard.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Api\V1\JobQueryController::convertToJobcard
* @see app/Http/Controllers/Api/V1/JobQueryController.php:109
* @route '/api/v1/job-queries/{query}/convert-to-jobcard'
*/
convertToJobcardForm.post = (args: { query: string | number | { id: string | number } } | [query: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: convertToJobcard.url(args, options),
    method: 'post',
})

convertToJobcard.form = convertToJobcardForm

const JobQueryController = { index, accept, decline, convertToJobcard }

export default JobQueryController