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

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

/**
* @see \App\Http\Controllers\Admin\AccrualEmailConfirmationController::accrual
* @see app/Http/Controllers/Admin/AccrualEmailConfirmationController.php:14
* @route '/admin/acreditaciones/confirmar/{token}'
*/
accrual.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 accrual.definition.url
            .replace('{token}', parsedArgs.token.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

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

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

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

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

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

accrual.form = accrualForm

const confirm = {
    accrual: Object.assign(accrual, accrual),
}

export default confirm