import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../../wayfinder'
/**
* @see \App\Http\Controllers\Admin\AccrualEmailConfirmationController::confirm
* @see app/Http/Controllers/Admin/AccrualEmailConfirmationController.php:14
* @route '/admin/acreditaciones/confirmar/{token}'
*/
export const confirm = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: confirm.url(args, options),
    method: 'get',
})

confirm.definition = {
    methods: ["get","head"],
    url: '/admin/acreditaciones/confirmar/{token}',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Admin\AccrualEmailConfirmationController::confirm
* @see app/Http/Controllers/Admin/AccrualEmailConfirmationController.php:14
* @route '/admin/acreditaciones/confirmar/{token}'
*/
confirm.url = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { token: args }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
        token: args.token,
    }

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

/**
* @see \App\Http\Controllers\Admin\AccrualEmailConfirmationController::confirm
* @see app/Http/Controllers/Admin/AccrualEmailConfirmationController.php:14
* @route '/admin/acreditaciones/confirmar/{token}'
*/
confirm.get = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: confirm.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\AccrualEmailConfirmationController::confirm
* @see app/Http/Controllers/Admin/AccrualEmailConfirmationController.php:14
* @route '/admin/acreditaciones/confirmar/{token}'
*/
confirm.head = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: confirm.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Admin\AccrualEmailConfirmationController::confirm
* @see app/Http/Controllers/Admin/AccrualEmailConfirmationController.php:14
* @route '/admin/acreditaciones/confirmar/{token}'
*/
const confirmForm = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: confirm.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\AccrualEmailConfirmationController::confirm
* @see app/Http/Controllers/Admin/AccrualEmailConfirmationController.php:14
* @route '/admin/acreditaciones/confirmar/{token}'
*/
confirmForm.get = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: confirm.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\AccrualEmailConfirmationController::confirm
* @see app/Http/Controllers/Admin/AccrualEmailConfirmationController.php:14
* @route '/admin/acreditaciones/confirmar/{token}'
*/
confirmForm.head = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: confirm.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

confirm.form = confirmForm

const AccrualEmailConfirmationController = { confirm }

export default AccrualEmailConfirmationController