import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../wayfinder'
import media from './media'
/**
* @see \App\Http\Controllers\Admin\ProjectController::show
* @see app/Http/Controllers/Admin/ProjectController.php:55
* @route '/admin/proyectos/{development}'
*/
export const show = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

show.definition = {
    methods: ["get","head"],
    url: '/admin/proyectos/{development}',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Admin\ProjectController::show
* @see app/Http/Controllers/Admin/ProjectController.php:55
* @route '/admin/proyectos/{development}'
*/
show.url = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { development: args }
    }

    if (typeof args === 'object' && !Array.isArray(args) && 'slug' in args) {
        args = { development: args.slug }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
        development: typeof args.development === 'object'
        ? args.development.slug
        : args.development,
    }

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

/**
* @see \App\Http\Controllers\Admin\ProjectController::show
* @see app/Http/Controllers/Admin/ProjectController.php:55
* @route '/admin/proyectos/{development}'
*/
show.get = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::show
* @see app/Http/Controllers/Admin/ProjectController.php:55
* @route '/admin/proyectos/{development}'
*/
show.head = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: show.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::show
* @see app/Http/Controllers/Admin/ProjectController.php:55
* @route '/admin/proyectos/{development}'
*/
const showForm = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::show
* @see app/Http/Controllers/Admin/ProjectController.php:55
* @route '/admin/proyectos/{development}'
*/
showForm.get = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::show
* @see app/Http/Controllers/Admin/ProjectController.php:55
* @route '/admin/proyectos/{development}'
*/
showForm.head = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

show.form = showForm

/**
* @see \App\Http\Controllers\Admin\ProjectController::update
* @see app/Http/Controllers/Admin/ProjectController.php:122
* @route '/admin/proyectos/{development}'
*/
export const update = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'put'> => ({
    url: update.url(args, options),
    method: 'put',
})

update.definition = {
    methods: ["put"],
    url: '/admin/proyectos/{development}',
} satisfies RouteDefinition<["put"]>

/**
* @see \App\Http\Controllers\Admin\ProjectController::update
* @see app/Http/Controllers/Admin/ProjectController.php:122
* @route '/admin/proyectos/{development}'
*/
update.url = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { development: args }
    }

    if (typeof args === 'object' && !Array.isArray(args) && 'slug' in args) {
        args = { development: args.slug }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
        development: typeof args.development === 'object'
        ? args.development.slug
        : args.development,
    }

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

/**
* @see \App\Http\Controllers\Admin\ProjectController::update
* @see app/Http/Controllers/Admin/ProjectController.php:122
* @route '/admin/proyectos/{development}'
*/
update.put = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'put'> => ({
    url: update.url(args, options),
    method: 'put',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::update
* @see app/Http/Controllers/Admin/ProjectController.php:122
* @route '/admin/proyectos/{development}'
*/
const updateForm = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: update.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PUT',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::update
* @see app/Http/Controllers/Admin/ProjectController.php:122
* @route '/admin/proyectos/{development}'
*/
updateForm.put = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: update.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PUT',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

update.form = updateForm

/**
* @see \App\Http\Controllers\Admin\ProjectController::lot
* @see app/Http/Controllers/Admin/ProjectController.php:156
* @route '/admin/proyectos/{development}/lotes/{lot}'
*/
export const lot = (args: { development: string | { slug: string }, lot: string | number } | [development: string | { slug: string }, lot: string | number ], options?: RouteQueryOptions): RouteDefinition<'put'> => ({
    url: lot.url(args, options),
    method: 'put',
})

lot.definition = {
    methods: ["put"],
    url: '/admin/proyectos/{development}/lotes/{lot}',
} satisfies RouteDefinition<["put"]>

/**
* @see \App\Http\Controllers\Admin\ProjectController::lot
* @see app/Http/Controllers/Admin/ProjectController.php:156
* @route '/admin/proyectos/{development}/lotes/{lot}'
*/
lot.url = (args: { development: string | { slug: string }, lot: string | number } | [development: string | { slug: string }, lot: string | number ], options?: RouteQueryOptions) => {
    if (Array.isArray(args)) {
        args = {
            development: args[0],
            lot: args[1],
        }
    }

    args = applyUrlDefaults(args)

    const parsedArgs = {
        development: typeof args.development === 'object'
        ? args.development.slug
        : args.development,
        lot: args.lot,
    }

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

/**
* @see \App\Http\Controllers\Admin\ProjectController::lot
* @see app/Http/Controllers/Admin/ProjectController.php:156
* @route '/admin/proyectos/{development}/lotes/{lot}'
*/
lot.put = (args: { development: string | { slug: string }, lot: string | number } | [development: string | { slug: string }, lot: string | number ], options?: RouteQueryOptions): RouteDefinition<'put'> => ({
    url: lot.url(args, options),
    method: 'put',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::lot
* @see app/Http/Controllers/Admin/ProjectController.php:156
* @route '/admin/proyectos/{development}/lotes/{lot}'
*/
const lotForm = (args: { development: string | { slug: string }, lot: string | number } | [development: string | { slug: string }, lot: string | number ], options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: lot.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PUT',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::lot
* @see app/Http/Controllers/Admin/ProjectController.php:156
* @route '/admin/proyectos/{development}/lotes/{lot}'
*/
lotForm.put = (args: { development: string | { slug: string }, lot: string | number } | [development: string | { slug: string }, lot: string | number ], options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: lot.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PUT',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

lot.form = lotForm

/**
* @see \App\Http\Controllers\Admin\ProjectController::pricing
* @see app/Http/Controllers/Admin/ProjectController.php:177
* @route '/admin/proyectos/{development}/precios'
*/
export const pricing = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'put'> => ({
    url: pricing.url(args, options),
    method: 'put',
})

pricing.definition = {
    methods: ["put"],
    url: '/admin/proyectos/{development}/precios',
} satisfies RouteDefinition<["put"]>

/**
* @see \App\Http\Controllers\Admin\ProjectController::pricing
* @see app/Http/Controllers/Admin/ProjectController.php:177
* @route '/admin/proyectos/{development}/precios'
*/
pricing.url = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { development: args }
    }

    if (typeof args === 'object' && !Array.isArray(args) && 'slug' in args) {
        args = { development: args.slug }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
        development: typeof args.development === 'object'
        ? args.development.slug
        : args.development,
    }

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

/**
* @see \App\Http\Controllers\Admin\ProjectController::pricing
* @see app/Http/Controllers/Admin/ProjectController.php:177
* @route '/admin/proyectos/{development}/precios'
*/
pricing.put = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'put'> => ({
    url: pricing.url(args, options),
    method: 'put',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::pricing
* @see app/Http/Controllers/Admin/ProjectController.php:177
* @route '/admin/proyectos/{development}/precios'
*/
const pricingForm = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: pricing.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PUT',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::pricing
* @see app/Http/Controllers/Admin/ProjectController.php:177
* @route '/admin/proyectos/{development}/precios'
*/
pricingForm.put = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: pricing.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PUT',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

pricing.form = pricingForm

/**
* @see \App\Http\Controllers\Admin\ProjectController::destroy
* @see app/Http/Controllers/Admin/ProjectController.php:318
* @route '/admin/proyectos/{development}'
*/
export const destroy = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroy.url(args, options),
    method: 'delete',
})

destroy.definition = {
    methods: ["delete"],
    url: '/admin/proyectos/{development}',
} satisfies RouteDefinition<["delete"]>

/**
* @see \App\Http\Controllers\Admin\ProjectController::destroy
* @see app/Http/Controllers/Admin/ProjectController.php:318
* @route '/admin/proyectos/{development}'
*/
destroy.url = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { development: args }
    }

    if (typeof args === 'object' && !Array.isArray(args) && 'slug' in args) {
        args = { development: args.slug }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
        development: typeof args.development === 'object'
        ? args.development.slug
        : args.development,
    }

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

/**
* @see \App\Http\Controllers\Admin\ProjectController::destroy
* @see app/Http/Controllers/Admin/ProjectController.php:318
* @route '/admin/proyectos/{development}'
*/
destroy.delete = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroy.url(args, options),
    method: 'delete',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::destroy
* @see app/Http/Controllers/Admin/ProjectController.php:318
* @route '/admin/proyectos/{development}'
*/
const destroyForm = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: destroy.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'DELETE',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\ProjectController::destroy
* @see app/Http/Controllers/Admin/ProjectController.php:318
* @route '/admin/proyectos/{development}'
*/
destroyForm.delete = (args: { development: string | { slug: string } } | [development: string | { slug: string } ] | string | { slug: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: destroy.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'DELETE',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

destroy.form = destroyForm

const projects = {
    show: Object.assign(show, show),
    update: Object.assign(update, update),
    lot: Object.assign(lot, lot),
    pricing: Object.assign(pricing, pricing),
    media: Object.assign(media, media),
    destroy: Object.assign(destroy, destroy),
}

export default projects