import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../wayfinder'
/**
* @see \Inertia\DevTools\Http\EntriesController::index
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:17
* @route '/_inertia/devtools/entries'
*/
export const index = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

index.definition = {
    methods: ["get","head"],
    url: '/_inertia/devtools/entries',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \Inertia\DevTools\Http\EntriesController::index
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:17
* @route '/_inertia/devtools/entries'
*/
index.url = (options?: RouteQueryOptions) => {
    return index.definition.url + queryParams(options)
}

/**
* @see \Inertia\DevTools\Http\EntriesController::index
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:17
* @route '/_inertia/devtools/entries'
*/
index.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

/**
* @see \Inertia\DevTools\Http\EntriesController::index
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:17
* @route '/_inertia/devtools/entries'
*/
index.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: index.url(options),
    method: 'head',
})

/**
* @see \Inertia\DevTools\Http\EntriesController::index
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:17
* @route '/_inertia/devtools/entries'
*/
const indexForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \Inertia\DevTools\Http\EntriesController::index
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:17
* @route '/_inertia/devtools/entries'
*/
indexForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \Inertia\DevTools\Http\EntriesController::index
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:17
* @route '/_inertia/devtools/entries'
*/
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 \Inertia\DevTools\Http\EntriesController::show
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:37
* @route '/_inertia/devtools/entries/{id}'
*/
export const show = (args: { id: string | number } | [id: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

show.definition = {
    methods: ["get","head"],
    url: '/_inertia/devtools/entries/{id}',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \Inertia\DevTools\Http\EntriesController::show
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:37
* @route '/_inertia/devtools/entries/{id}'
*/
show.url = (args: { id: string | number } | [id: string | number ] | string | number, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { id: args }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
        id: args.id,
    }

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

/**
* @see \Inertia\DevTools\Http\EntriesController::show
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:37
* @route '/_inertia/devtools/entries/{id}'
*/
show.get = (args: { id: string | number } | [id: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

/**
* @see \Inertia\DevTools\Http\EntriesController::show
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:37
* @route '/_inertia/devtools/entries/{id}'
*/
show.head = (args: { id: string | number } | [id: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: show.url(args, options),
    method: 'head',
})

/**
* @see \Inertia\DevTools\Http\EntriesController::show
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:37
* @route '/_inertia/devtools/entries/{id}'
*/
const showForm = (args: { id: string | number } | [id: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, options),
    method: 'get',
})

/**
* @see \Inertia\DevTools\Http\EntriesController::show
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:37
* @route '/_inertia/devtools/entries/{id}'
*/
showForm.get = (args: { id: string | number } | [id: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, options),
    method: 'get',
})

/**
* @see \Inertia\DevTools\Http\EntriesController::show
* @see vendor/inertiajs/inertia-laravel/src/DevTools/Http/EntriesController.php:37
* @route '/_inertia/devtools/entries/{id}'
*/
showForm.head = (args: { id: string | number } | [id: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

show.form = showForm

const EntriesController = { index, show }

export default EntriesController