import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../wayfinder'
/**
* @see \App\Http\Controllers\EmailConfirmationController::investment
* @see app/Http/Controllers/EmailConfirmationController.php:15
* @route '/confirmaciones/correo/inversion/{token}'
*/
export const investment = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: investment.url(args, options),
    method: 'get',
})

investment.definition = {
    methods: ["get","head"],
    url: '/confirmaciones/correo/inversion/{token}',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\EmailConfirmationController::investment
* @see app/Http/Controllers/EmailConfirmationController.php:15
* @route '/confirmaciones/correo/inversion/{token}'
*/
investment.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 investment.definition.url
            .replace('{token}', parsedArgs.token.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\EmailConfirmationController::investment
* @see app/Http/Controllers/EmailConfirmationController.php:15
* @route '/confirmaciones/correo/inversion/{token}'
*/
investment.get = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: investment.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\EmailConfirmationController::investment
* @see app/Http/Controllers/EmailConfirmationController.php:15
* @route '/confirmaciones/correo/inversion/{token}'
*/
investment.head = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: investment.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\EmailConfirmationController::investment
* @see app/Http/Controllers/EmailConfirmationController.php:15
* @route '/confirmaciones/correo/inversion/{token}'
*/
const investmentForm = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: investment.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\EmailConfirmationController::investment
* @see app/Http/Controllers/EmailConfirmationController.php:15
* @route '/confirmaciones/correo/inversion/{token}'
*/
investmentForm.get = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: investment.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\EmailConfirmationController::investment
* @see app/Http/Controllers/EmailConfirmationController.php:15
* @route '/confirmaciones/correo/inversion/{token}'
*/
investmentForm.head = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: investment.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

investment.form = investmentForm

/**
* @see \App\Http\Controllers\EmailConfirmationController::withdrawal
* @see app/Http/Controllers/EmailConfirmationController.php:34
* @route '/confirmaciones/correo/retiro/{token}'
*/
export const withdrawal = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: withdrawal.url(args, options),
    method: 'get',
})

withdrawal.definition = {
    methods: ["get","head"],
    url: '/confirmaciones/correo/retiro/{token}',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\EmailConfirmationController::withdrawal
* @see app/Http/Controllers/EmailConfirmationController.php:34
* @route '/confirmaciones/correo/retiro/{token}'
*/
withdrawal.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 withdrawal.definition.url
            .replace('{token}', parsedArgs.token.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\EmailConfirmationController::withdrawal
* @see app/Http/Controllers/EmailConfirmationController.php:34
* @route '/confirmaciones/correo/retiro/{token}'
*/
withdrawal.get = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: withdrawal.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\EmailConfirmationController::withdrawal
* @see app/Http/Controllers/EmailConfirmationController.php:34
* @route '/confirmaciones/correo/retiro/{token}'
*/
withdrawal.head = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: withdrawal.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\EmailConfirmationController::withdrawal
* @see app/Http/Controllers/EmailConfirmationController.php:34
* @route '/confirmaciones/correo/retiro/{token}'
*/
const withdrawalForm = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: withdrawal.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\EmailConfirmationController::withdrawal
* @see app/Http/Controllers/EmailConfirmationController.php:34
* @route '/confirmaciones/correo/retiro/{token}'
*/
withdrawalForm.get = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: withdrawal.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\EmailConfirmationController::withdrawal
* @see app/Http/Controllers/EmailConfirmationController.php:34
* @route '/confirmaciones/correo/retiro/{token}'
*/
withdrawalForm.head = (args: { token: string | number } | [token: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: withdrawal.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

withdrawal.form = withdrawalForm

const email = {
    investment: Object.assign(investment, investment),
    withdrawal: Object.assign(withdrawal, withdrawal),
}

export default email