import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../../wayfinder'
/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::index
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:21
* @route '/admin/retiros/solicitudes'
*/
export const index = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

index.definition = {
    methods: ["get","head"],
    url: '/admin/retiros/solicitudes',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::index
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:21
* @route '/admin/retiros/solicitudes'
*/
index.url = (options?: RouteQueryOptions) => {
    return index.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::index
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:21
* @route '/admin/retiros/solicitudes'
*/
index.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::index
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:21
* @route '/admin/retiros/solicitudes'
*/
index.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: index.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::index
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:21
* @route '/admin/retiros/solicitudes'
*/
const indexForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::index
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:21
* @route '/admin/retiros/solicitudes'
*/
indexForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::index
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:21
* @route '/admin/retiros/solicitudes'
*/
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\Admin\WithdrawalRequestManageController::approve
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:102
* @route '/admin/retiros/solicitudes/{withdrawal_request}/aprobar'
*/
export const approve = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: approve.url(args, options),
    method: 'patch',
})

approve.definition = {
    methods: ["patch"],
    url: '/admin/retiros/solicitudes/{withdrawal_request}/aprobar',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::approve
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:102
* @route '/admin/retiros/solicitudes/{withdrawal_request}/aprobar'
*/
approve.url = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { withdrawal_request: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::approve
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:102
* @route '/admin/retiros/solicitudes/{withdrawal_request}/aprobar'
*/
approve.patch = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: approve.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::approve
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:102
* @route '/admin/retiros/solicitudes/{withdrawal_request}/aprobar'
*/
const approveForm = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: approve.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::approve
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:102
* @route '/admin/retiros/solicitudes/{withdrawal_request}/aprobar'
*/
approveForm.patch = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: approve.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

approve.form = approveForm

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::reject
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:159
* @route '/admin/retiros/solicitudes/{withdrawal_request}/rechazar'
*/
export const reject = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: reject.url(args, options),
    method: 'patch',
})

reject.definition = {
    methods: ["patch"],
    url: '/admin/retiros/solicitudes/{withdrawal_request}/rechazar',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::reject
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:159
* @route '/admin/retiros/solicitudes/{withdrawal_request}/rechazar'
*/
reject.url = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { withdrawal_request: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::reject
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:159
* @route '/admin/retiros/solicitudes/{withdrawal_request}/rechazar'
*/
reject.patch = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: reject.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::reject
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:159
* @route '/admin/retiros/solicitudes/{withdrawal_request}/rechazar'
*/
const rejectForm = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: reject.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\WithdrawalRequestManageController::reject
* @see app/Http/Controllers/Admin/WithdrawalRequestManageController.php:159
* @route '/admin/retiros/solicitudes/{withdrawal_request}/rechazar'
*/
rejectForm.patch = (args: { withdrawal_request: number | { id: number } } | [withdrawal_request: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: reject.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

reject.form = rejectForm

const WithdrawalRequestManageController = { index, approve, reject }

export default WithdrawalRequestManageController