import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../../wayfinder'
/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::index
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:29
 * @route '/user/passkeys/options'
 */
export const index = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

index.definition = {
    methods: ["get","head"],
    url: '/user/passkeys/options',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::index
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:29
 * @route '/user/passkeys/options'
 */
index.url = (options?: RouteQueryOptions) => {
    return index.definition.url + queryParams(options)
}

/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::index
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:29
 * @route '/user/passkeys/options'
 */
index.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})
/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::index
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:29
 * @route '/user/passkeys/options'
 */
index.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: index.url(options),
    method: 'head',
})

    /**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::index
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:29
 * @route '/user/passkeys/options'
 */
    const indexForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
        action: index.url(options),
        method: 'get',
    })

            /**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::index
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:29
 * @route '/user/passkeys/options'
 */
        indexForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: index.url(options),
            method: 'get',
        })
            /**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::index
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:29
 * @route '/user/passkeys/options'
 */
        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 \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::store
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:48
 * @route '/user/passkeys'
 */
export const store = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

store.definition = {
    methods: ["post"],
    url: '/user/passkeys',
} satisfies RouteDefinition<["post"]>

/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::store
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:48
 * @route '/user/passkeys'
 */
store.url = (options?: RouteQueryOptions) => {
    return store.definition.url + queryParams(options)
}

/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::store
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:48
 * @route '/user/passkeys'
 */
store.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

    /**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::store
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:48
 * @route '/user/passkeys'
 */
    const storeForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: store.url(options),
        method: 'post',
    })

            /**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::store
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:48
 * @route '/user/passkeys'
 */
        storeForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: store.url(options),
            method: 'post',
        })
    
    store.form = storeForm
/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::destroy
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:68
 * @route '/user/passkeys/{passkey}'
 */
export const destroy = (args: { passkey: number | { id: number } } | [passkey: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroy.url(args, options),
    method: 'delete',
})

destroy.definition = {
    methods: ["delete"],
    url: '/user/passkeys/{passkey}',
} satisfies RouteDefinition<["delete"]>

/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::destroy
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:68
 * @route '/user/passkeys/{passkey}'
 */
destroy.url = (args: { passkey: number | { id: number } } | [passkey: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { passkey: args }
    }

            if (typeof args === 'object' && !Array.isArray(args) && 'id' in args) {
            args = { passkey: args.id }
        }
    
    if (Array.isArray(args)) {
        args = {
                    passkey: args[0],
                }
    }

    args = applyUrlDefaults(args)

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

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

/**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::destroy
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:68
 * @route '/user/passkeys/{passkey}'
 */
destroy.delete = (args: { passkey: number | { id: number } } | [passkey: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroy.url(args, options),
    method: 'delete',
})

    /**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::destroy
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:68
 * @route '/user/passkeys/{passkey}'
 */
    const destroyForm = (args: { passkey: number | { id: number } } | [passkey: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: destroy.url(args, {
                    [options?.mergeQuery ? 'mergeQuery' : 'query']: {
                        _method: 'DELETE',
                        ...(options?.query ?? options?.mergeQuery ?? {}),
                    }
                }),
        method: 'post',
    })

            /**
* @see \Laravel\Passkeys\Http\Controllers\PasskeyRegistrationController::destroy
 * @see vendor/laravel/passkeys/src/Http/Controllers/PasskeyRegistrationController.php:68
 * @route '/user/passkeys/{passkey}'
 */
        destroyForm.delete = (args: { passkey: number | { id: number } } | [passkey: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: destroy.url(args, {
                        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
                            _method: 'DELETE',
                            ...(options?.query ?? options?.mergeQuery ?? {}),
                        }
                    }),
            method: 'post',
        })
    
    destroy.form = destroyForm
const PasskeyRegistrationController = { index, store, destroy }

export default PasskeyRegistrationController