import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../wayfinder'
/**
* @see \App\Http\Controllers\CreditNotesController::searchInvoices
* @see app/Http/Controllers/CreditNotesController.php:357
* @route '/credit-notes/search/invoices'
*/
export const searchInvoices = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: searchInvoices.url(options),
    method: 'get',
})

searchInvoices.definition = {
    methods: ["get","head"],
    url: '/credit-notes/search/invoices',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\CreditNotesController::searchInvoices
* @see app/Http/Controllers/CreditNotesController.php:357
* @route '/credit-notes/search/invoices'
*/
searchInvoices.url = (options?: RouteQueryOptions) => {
    return searchInvoices.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\CreditNotesController::searchInvoices
* @see app/Http/Controllers/CreditNotesController.php:357
* @route '/credit-notes/search/invoices'
*/
searchInvoices.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: searchInvoices.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::searchInvoices
* @see app/Http/Controllers/CreditNotesController.php:357
* @route '/credit-notes/search/invoices'
*/
searchInvoices.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: searchInvoices.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\CreditNotesController::searchInvoices
* @see app/Http/Controllers/CreditNotesController.php:357
* @route '/credit-notes/search/invoices'
*/
const searchInvoicesForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: searchInvoices.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::searchInvoices
* @see app/Http/Controllers/CreditNotesController.php:357
* @route '/credit-notes/search/invoices'
*/
searchInvoicesForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: searchInvoices.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::searchInvoices
* @see app/Http/Controllers/CreditNotesController.php:357
* @route '/credit-notes/search/invoices'
*/
searchInvoicesForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: searchInvoices.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

searchInvoices.form = searchInvoicesForm

/**
* @see \App\Http\Controllers\CreditNotesController::searchProducts
* @see app/Http/Controllers/CreditNotesController.php:389
* @route '/credit-notes/search/products'
*/
export const searchProducts = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: searchProducts.url(options),
    method: 'get',
})

searchProducts.definition = {
    methods: ["get","head"],
    url: '/credit-notes/search/products',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\CreditNotesController::searchProducts
* @see app/Http/Controllers/CreditNotesController.php:389
* @route '/credit-notes/search/products'
*/
searchProducts.url = (options?: RouteQueryOptions) => {
    return searchProducts.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\CreditNotesController::searchProducts
* @see app/Http/Controllers/CreditNotesController.php:389
* @route '/credit-notes/search/products'
*/
searchProducts.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: searchProducts.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::searchProducts
* @see app/Http/Controllers/CreditNotesController.php:389
* @route '/credit-notes/search/products'
*/
searchProducts.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: searchProducts.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\CreditNotesController::searchProducts
* @see app/Http/Controllers/CreditNotesController.php:389
* @route '/credit-notes/search/products'
*/
const searchProductsForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: searchProducts.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::searchProducts
* @see app/Http/Controllers/CreditNotesController.php:389
* @route '/credit-notes/search/products'
*/
searchProductsForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: searchProducts.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::searchProducts
* @see app/Http/Controllers/CreditNotesController.php:389
* @route '/credit-notes/search/products'
*/
searchProductsForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: searchProducts.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

searchProducts.form = searchProductsForm

/**
* @see \App\Http\Controllers\CreditNotesController::index
* @see app/Http/Controllers/CreditNotesController.php:27
* @route '/credit-notes'
*/
export const index = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

index.definition = {
    methods: ["get","head"],
    url: '/credit-notes',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\CreditNotesController::index
* @see app/Http/Controllers/CreditNotesController.php:27
* @route '/credit-notes'
*/
index.url = (options?: RouteQueryOptions) => {
    return index.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\CreditNotesController::index
* @see app/Http/Controllers/CreditNotesController.php:27
* @route '/credit-notes'
*/
index.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::index
* @see app/Http/Controllers/CreditNotesController.php:27
* @route '/credit-notes'
*/
index.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: index.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\CreditNotesController::index
* @see app/Http/Controllers/CreditNotesController.php:27
* @route '/credit-notes'
*/
const indexForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::index
* @see app/Http/Controllers/CreditNotesController.php:27
* @route '/credit-notes'
*/
indexForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::index
* @see app/Http/Controllers/CreditNotesController.php:27
* @route '/credit-notes'
*/
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 \App\Http\Controllers\CreditNotesController::create
* @see app/Http/Controllers/CreditNotesController.php:142
* @route '/credit-notes/create'
*/
export const create = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: create.url(options),
    method: 'get',
})

create.definition = {
    methods: ["get","head"],
    url: '/credit-notes/create',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\CreditNotesController::create
* @see app/Http/Controllers/CreditNotesController.php:142
* @route '/credit-notes/create'
*/
create.url = (options?: RouteQueryOptions) => {
    return create.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\CreditNotesController::create
* @see app/Http/Controllers/CreditNotesController.php:142
* @route '/credit-notes/create'
*/
create.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: create.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::create
* @see app/Http/Controllers/CreditNotesController.php:142
* @route '/credit-notes/create'
*/
create.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: create.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\CreditNotesController::create
* @see app/Http/Controllers/CreditNotesController.php:142
* @route '/credit-notes/create'
*/
const createForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: create.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::create
* @see app/Http/Controllers/CreditNotesController.php:142
* @route '/credit-notes/create'
*/
createForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: create.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::create
* @see app/Http/Controllers/CreditNotesController.php:142
* @route '/credit-notes/create'
*/
createForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: create.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

create.form = createForm

/**
* @see \App\Http\Controllers\CreditNotesController::store
* @see app/Http/Controllers/CreditNotesController.php:176
* @route '/credit-notes'
*/
export const store = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

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

/**
* @see \App\Http\Controllers\CreditNotesController::store
* @see app/Http/Controllers/CreditNotesController.php:176
* @route '/credit-notes'
*/
store.url = (options?: RouteQueryOptions) => {
    return store.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\CreditNotesController::store
* @see app/Http/Controllers/CreditNotesController.php:176
* @route '/credit-notes'
*/
store.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\CreditNotesController::store
* @see app/Http/Controllers/CreditNotesController.php:176
* @route '/credit-notes'
*/
const storeForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: store.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\CreditNotesController::store
* @see app/Http/Controllers/CreditNotesController.php:176
* @route '/credit-notes'
*/
storeForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: store.url(options),
    method: 'post',
})

store.form = storeForm

/**
* @see \App\Http\Controllers\CreditNotesController::show
* @see app/Http/Controllers/CreditNotesController.php:282
* @route '/credit-notes/{creditNote}'
*/
export const show = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

show.definition = {
    methods: ["get","head"],
    url: '/credit-notes/{creditNote}',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\CreditNotesController::show
* @see app/Http/Controllers/CreditNotesController.php:282
* @route '/credit-notes/{creditNote}'
*/
show.url = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { creditNote: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\CreditNotesController::show
* @see app/Http/Controllers/CreditNotesController.php:282
* @route '/credit-notes/{creditNote}'
*/
show.get = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::show
* @see app/Http/Controllers/CreditNotesController.php:282
* @route '/credit-notes/{creditNote}'
*/
show.head = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: show.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\CreditNotesController::show
* @see app/Http/Controllers/CreditNotesController.php:282
* @route '/credit-notes/{creditNote}'
*/
const showForm = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::show
* @see app/Http/Controllers/CreditNotesController.php:282
* @route '/credit-notes/{creditNote}'
*/
showForm.get = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: show.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::show
* @see app/Http/Controllers/CreditNotesController.php:282
* @route '/credit-notes/{creditNote}'
*/
showForm.head = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: 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

/**
* @see \App\Http\Controllers\CreditNotesController::edit
* @see app/Http/Controllers/CreditNotesController.php:332
* @route '/credit-notes/{creditNote}/edit'
*/
export const edit = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: edit.url(args, options),
    method: 'get',
})

edit.definition = {
    methods: ["get","head"],
    url: '/credit-notes/{creditNote}/edit',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\CreditNotesController::edit
* @see app/Http/Controllers/CreditNotesController.php:332
* @route '/credit-notes/{creditNote}/edit'
*/
edit.url = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { creditNote: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\CreditNotesController::edit
* @see app/Http/Controllers/CreditNotesController.php:332
* @route '/credit-notes/{creditNote}/edit'
*/
edit.get = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: edit.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::edit
* @see app/Http/Controllers/CreditNotesController.php:332
* @route '/credit-notes/{creditNote}/edit'
*/
edit.head = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: edit.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\CreditNotesController::edit
* @see app/Http/Controllers/CreditNotesController.php:332
* @route '/credit-notes/{creditNote}/edit'
*/
const editForm = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: edit.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::edit
* @see app/Http/Controllers/CreditNotesController.php:332
* @route '/credit-notes/{creditNote}/edit'
*/
editForm.get = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: edit.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\CreditNotesController::edit
* @see app/Http/Controllers/CreditNotesController.php:332
* @route '/credit-notes/{creditNote}/edit'
*/
editForm.head = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: edit.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

edit.form = editForm

/**
* @see \App\Http\Controllers\CreditNotesController::update
* @see app/Http/Controllers/CreditNotesController.php:410
* @route '/credit-notes/{creditNote}'
*/
export const update = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'put'> => ({
    url: update.url(args, options),
    method: 'put',
})

update.definition = {
    methods: ["put"],
    url: '/credit-notes/{creditNote}',
} satisfies RouteDefinition<["put"]>

/**
* @see \App\Http\Controllers\CreditNotesController::update
* @see app/Http/Controllers/CreditNotesController.php:410
* @route '/credit-notes/{creditNote}'
*/
update.url = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { creditNote: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\CreditNotesController::update
* @see app/Http/Controllers/CreditNotesController.php:410
* @route '/credit-notes/{creditNote}'
*/
update.put = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'put'> => ({
    url: update.url(args, options),
    method: 'put',
})

/**
* @see \App\Http\Controllers\CreditNotesController::update
* @see app/Http/Controllers/CreditNotesController.php:410
* @route '/credit-notes/{creditNote}'
*/
const updateForm = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: update.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PUT',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\CreditNotesController::update
* @see app/Http/Controllers/CreditNotesController.php:410
* @route '/credit-notes/{creditNote}'
*/
updateForm.put = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, 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\CreditNotesController::destroy
* @see app/Http/Controllers/CreditNotesController.php:514
* @route '/credit-notes/{creditNote}'
*/
export const destroy = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroy.url(args, options),
    method: 'delete',
})

destroy.definition = {
    methods: ["delete"],
    url: '/credit-notes/{creditNote}',
} satisfies RouteDefinition<["delete"]>

/**
* @see \App\Http\Controllers\CreditNotesController::destroy
* @see app/Http/Controllers/CreditNotesController.php:514
* @route '/credit-notes/{creditNote}'
*/
destroy.url = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { creditNote: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\CreditNotesController::destroy
* @see app/Http/Controllers/CreditNotesController.php:514
* @route '/credit-notes/{creditNote}'
*/
destroy.delete = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroy.url(args, options),
    method: 'delete',
})

/**
* @see \App\Http\Controllers\CreditNotesController::destroy
* @see app/Http/Controllers/CreditNotesController.php:514
* @route '/credit-notes/{creditNote}'
*/
const destroyForm = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: destroy.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'DELETE',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\CreditNotesController::destroy
* @see app/Http/Controllers/CreditNotesController.php:514
* @route '/credit-notes/{creditNote}'
*/
destroyForm.delete = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: destroy.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'DELETE',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

destroy.form = destroyForm

/**
* @see \App\Http\Controllers\CreditNotesController::updateStatus
* @see app/Http/Controllers/CreditNotesController.php:524
* @route '/credit-notes/{creditNote}/status'
*/
export const updateStatus = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: updateStatus.url(args, options),
    method: 'patch',
})

updateStatus.definition = {
    methods: ["patch"],
    url: '/credit-notes/{creditNote}/status',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\CreditNotesController::updateStatus
* @see app/Http/Controllers/CreditNotesController.php:524
* @route '/credit-notes/{creditNote}/status'
*/
updateStatus.url = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { creditNote: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\CreditNotesController::updateStatus
* @see app/Http/Controllers/CreditNotesController.php:524
* @route '/credit-notes/{creditNote}/status'
*/
updateStatus.patch = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: updateStatus.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\CreditNotesController::updateStatus
* @see app/Http/Controllers/CreditNotesController.php:524
* @route '/credit-notes/{creditNote}/status'
*/
const updateStatusForm = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: updateStatus.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\CreditNotesController::updateStatus
* @see app/Http/Controllers/CreditNotesController.php:524
* @route '/credit-notes/{creditNote}/status'
*/
updateStatusForm.patch = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: updateStatus.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

updateStatus.form = updateStatusForm

/**
* @see \App\Http\Controllers\CreditNotesController::storePayment
* @see app/Http/Controllers/CreditNotesController.php:536
* @route '/credit-notes/{creditNote}/payments'
*/
export const storePayment = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: storePayment.url(args, options),
    method: 'post',
})

storePayment.definition = {
    methods: ["post"],
    url: '/credit-notes/{creditNote}/payments',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\CreditNotesController::storePayment
* @see app/Http/Controllers/CreditNotesController.php:536
* @route '/credit-notes/{creditNote}/payments'
*/
storePayment.url = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { creditNote: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\CreditNotesController::storePayment
* @see app/Http/Controllers/CreditNotesController.php:536
* @route '/credit-notes/{creditNote}/payments'
*/
storePayment.post = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: storePayment.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\CreditNotesController::storePayment
* @see app/Http/Controllers/CreditNotesController.php:536
* @route '/credit-notes/{creditNote}/payments'
*/
const storePaymentForm = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: storePayment.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\CreditNotesController::storePayment
* @see app/Http/Controllers/CreditNotesController.php:536
* @route '/credit-notes/{creditNote}/payments'
*/
storePaymentForm.post = (args: { creditNote: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: storePayment.url(args, options),
    method: 'post',
})

storePayment.form = storePaymentForm

/**
* @see \App\Http\Controllers\CreditNotesController::destroyPayment
* @see app/Http/Controllers/CreditNotesController.php:593
* @route '/credit-notes/{creditNote}/payments/{payment}'
*/
export const destroyPayment = (args: { creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } ], options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroyPayment.url(args, options),
    method: 'delete',
})

destroyPayment.definition = {
    methods: ["delete"],
    url: '/credit-notes/{creditNote}/payments/{payment}',
} satisfies RouteDefinition<["delete"]>

/**
* @see \App\Http\Controllers\CreditNotesController::destroyPayment
* @see app/Http/Controllers/CreditNotesController.php:593
* @route '/credit-notes/{creditNote}/payments/{payment}'
*/
destroyPayment.url = (args: { creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } ], options?: RouteQueryOptions) => {
    if (Array.isArray(args)) {
        args = {
            creditNote: args[0],
            payment: args[1],
        }
    }

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\CreditNotesController::destroyPayment
* @see app/Http/Controllers/CreditNotesController.php:593
* @route '/credit-notes/{creditNote}/payments/{payment}'
*/
destroyPayment.delete = (args: { creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } ], options?: RouteQueryOptions): RouteDefinition<'delete'> => ({
    url: destroyPayment.url(args, options),
    method: 'delete',
})

/**
* @see \App\Http\Controllers\CreditNotesController::destroyPayment
* @see app/Http/Controllers/CreditNotesController.php:593
* @route '/credit-notes/{creditNote}/payments/{payment}'
*/
const destroyPaymentForm = (args: { creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } ], options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: destroyPayment.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'DELETE',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\CreditNotesController::destroyPayment
* @see app/Http/Controllers/CreditNotesController.php:593
* @route '/credit-notes/{creditNote}/payments/{payment}'
*/
destroyPaymentForm.delete = (args: { creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } } | [creditNote: string | number | { id: string | number }, payment: string | number | { id: string | number } ], options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: destroyPayment.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'DELETE',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

destroyPayment.form = destroyPaymentForm

const CreditNotesController = { searchInvoices, searchProducts, index, create, store, show, edit, update, destroy, updateStatus, storePayment, destroyPayment }

export default CreditNotesController