import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../wayfinder'
/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::inspect
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:201
* @route '/admin/digitalizador/analizar'
*/
export const inspect = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: inspect.url(options),
    method: 'post',
})

inspect.definition = {
    methods: ["post"],
    url: '/admin/digitalizador/analizar',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::inspect
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:201
* @route '/admin/digitalizador/analizar'
*/
inspect.url = (options?: RouteQueryOptions) => {
    return inspect.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::inspect
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:201
* @route '/admin/digitalizador/analizar'
*/
inspect.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: inspect.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::inspect
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:201
* @route '/admin/digitalizador/analizar'
*/
const inspectForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: inspect.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::inspect
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:201
* @route '/admin/digitalizador/analizar'
*/
inspectForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: inspect.url(options),
    method: 'post',
})

inspect.form = inspectForm

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::digitize
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:212
* @route '/admin/digitalizador/digitalizar'
*/
export const digitize = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: digitize.url(options),
    method: 'post',
})

digitize.definition = {
    methods: ["post"],
    url: '/admin/digitalizador/digitalizar',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::digitize
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:212
* @route '/admin/digitalizador/digitalizar'
*/
digitize.url = (options?: RouteQueryOptions) => {
    return digitize.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::digitize
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:212
* @route '/admin/digitalizador/digitalizar'
*/
digitize.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: digitize.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::digitize
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:212
* @route '/admin/digitalizador/digitalizar'
*/
const digitizeForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: digitize.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::digitize
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:212
* @route '/admin/digitalizador/digitalizar'
*/
digitizeForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: digitize.url(options),
    method: 'post',
})

digitize.form = digitizeForm

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::lot
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:80
* @route '/admin/digitalizador/lote/{lot}'
*/
export const lot = (args: { lot: string | number } | [lot: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: lot.url(args, options),
    method: 'patch',
})

lot.definition = {
    methods: ["patch"],
    url: '/admin/digitalizador/lote/{lot}',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::lot
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:80
* @route '/admin/digitalizador/lote/{lot}'
*/
lot.url = (args: { lot: string | number } | [lot: string | number ] | string | number, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { lot: args }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
        lot: args.lot,
    }

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

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::lot
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:80
* @route '/admin/digitalizador/lote/{lot}'
*/
lot.patch = (args: { lot: string | number } | [lot: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: lot.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::lot
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:80
* @route '/admin/digitalizador/lote/{lot}'
*/
const lotForm = (args: { lot: string | number } | [lot: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: lot.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\MasterplanDigitizerController::lot
* @see app/Http/Controllers/Admin/MasterplanDigitizerController.php:80
* @route '/admin/digitalizador/lote/{lot}'
*/
lotForm.patch = (args: { lot: string | number } | [lot: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: lot.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

lot.form = lotForm

const digitalizer = {
    inspect: Object.assign(inspect, inspect),
    digitize: Object.assign(digitize, digitize),
    lot: Object.assign(lot, lot),
}

export default digitalizer