import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../wayfinder'
/**
* @see \App\Http\Controllers\FinancingController::record
 * @see app/Http/Controllers/FinancingController.php:171
 * @route '/financing/payments'
 */
export const record = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: record.url(options),
    method: 'post',
})

record.definition = {
    methods: ["post"],
    url: '/financing/payments',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\FinancingController::record
 * @see app/Http/Controllers/FinancingController.php:171
 * @route '/financing/payments'
 */
record.url = (options?: RouteQueryOptions) => {
    return record.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\FinancingController::record
 * @see app/Http/Controllers/FinancingController.php:171
 * @route '/financing/payments'
 */
record.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: record.url(options),
    method: 'post',
})

    /**
* @see \App\Http\Controllers\FinancingController::record
 * @see app/Http/Controllers/FinancingController.php:171
 * @route '/financing/payments'
 */
    const recordForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: record.url(options),
        method: 'post',
    })

            /**
* @see \App\Http\Controllers\FinancingController::record
 * @see app/Http/Controllers/FinancingController.php:171
 * @route '/financing/payments'
 */
        recordForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: record.url(options),
            method: 'post',
        })
    
    record.form = recordForm
/**
* @see \App\Http\Controllers\FinancingController::create
 * @see app/Http/Controllers/FinancingController.php:223
 * @route '/financing/{financing}/payments/create'
 */
export const create = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: create.url(args, options),
    method: 'get',
})

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

/**
* @see \App\Http\Controllers\FinancingController::create
 * @see app/Http/Controllers/FinancingController.php:223
 * @route '/financing/{financing}/payments/create'
 */
create.url = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { financing: args }
    }

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\FinancingController::create
 * @see app/Http/Controllers/FinancingController.php:223
 * @route '/financing/{financing}/payments/create'
 */
create.get = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: create.url(args, options),
    method: 'get',
})
/**
* @see \App\Http\Controllers\FinancingController::create
 * @see app/Http/Controllers/FinancingController.php:223
 * @route '/financing/{financing}/payments/create'
 */
create.head = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: create.url(args, options),
    method: 'head',
})

    /**
* @see \App\Http\Controllers\FinancingController::create
 * @see app/Http/Controllers/FinancingController.php:223
 * @route '/financing/{financing}/payments/create'
 */
    const createForm = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
        action: create.url(args, options),
        method: 'get',
    })

            /**
* @see \App\Http\Controllers\FinancingController::create
 * @see app/Http/Controllers/FinancingController.php:223
 * @route '/financing/{financing}/payments/create'
 */
        createForm.get = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: create.url(args, options),
            method: 'get',
        })
            /**
* @see \App\Http\Controllers\FinancingController::create
 * @see app/Http/Controllers/FinancingController.php:223
 * @route '/financing/{financing}/payments/create'
 */
        createForm.head = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: create.url(args, {
                        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
                            _method: 'HEAD',
                            ...(options?.query ?? options?.mergeQuery ?? {}),
                        }
                    }),
            method: 'get',
        })
    
    create.form = createForm
/**
* @see \App\Http\Controllers\FinancingController::history
 * @see app/Http/Controllers/FinancingController.php:209
 * @route '/financing/{financing}/payments'
 */
export const history = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: history.url(args, options),
    method: 'get',
})

history.definition = {
    methods: ["get","head"],
    url: '/financing/{financing}/payments',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\FinancingController::history
 * @see app/Http/Controllers/FinancingController.php:209
 * @route '/financing/{financing}/payments'
 */
history.url = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { financing: args }
    }

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\FinancingController::history
 * @see app/Http/Controllers/FinancingController.php:209
 * @route '/financing/{financing}/payments'
 */
history.get = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: history.url(args, options),
    method: 'get',
})
/**
* @see \App\Http\Controllers\FinancingController::history
 * @see app/Http/Controllers/FinancingController.php:209
 * @route '/financing/{financing}/payments'
 */
history.head = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: history.url(args, options),
    method: 'head',
})

    /**
* @see \App\Http\Controllers\FinancingController::history
 * @see app/Http/Controllers/FinancingController.php:209
 * @route '/financing/{financing}/payments'
 */
    const historyForm = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
        action: history.url(args, options),
        method: 'get',
    })

            /**
* @see \App\Http\Controllers\FinancingController::history
 * @see app/Http/Controllers/FinancingController.php:209
 * @route '/financing/{financing}/payments'
 */
        historyForm.get = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: history.url(args, options),
            method: 'get',
        })
            /**
* @see \App\Http\Controllers\FinancingController::history
 * @see app/Http/Controllers/FinancingController.php:209
 * @route '/financing/{financing}/payments'
 */
        historyForm.head = (args: { financing: string | number | { id: string | number } } | [financing: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: history.url(args, {
                        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
                            _method: 'HEAD',
                            ...(options?.query ?? options?.mergeQuery ?? {}),
                        }
                    }),
            method: 'get',
        })
    
    history.form = historyForm
/**
* @see \App\Http\Controllers\FinancingController::receipt
 * @see app/Http/Controllers/FinancingController.php:239
 * @route '/financing/payments/{payment}/receipt'
 */
export const receipt = (args: { payment: string | number | { id: string | number } } | [payment: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: receipt.url(args, options),
    method: 'get',
})

receipt.definition = {
    methods: ["get","head"],
    url: '/financing/payments/{payment}/receipt',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\FinancingController::receipt
 * @see app/Http/Controllers/FinancingController.php:239
 * @route '/financing/payments/{payment}/receipt'
 */
receipt.url = (args: { payment: string | number | { id: string | number } } | [payment: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { payment: args }
    }

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\FinancingController::receipt
 * @see app/Http/Controllers/FinancingController.php:239
 * @route '/financing/payments/{payment}/receipt'
 */
receipt.get = (args: { payment: string | number | { id: string | number } } | [payment: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: receipt.url(args, options),
    method: 'get',
})
/**
* @see \App\Http\Controllers\FinancingController::receipt
 * @see app/Http/Controllers/FinancingController.php:239
 * @route '/financing/payments/{payment}/receipt'
 */
receipt.head = (args: { payment: string | number | { id: string | number } } | [payment: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: receipt.url(args, options),
    method: 'head',
})

    /**
* @see \App\Http\Controllers\FinancingController::receipt
 * @see app/Http/Controllers/FinancingController.php:239
 * @route '/financing/payments/{payment}/receipt'
 */
    const receiptForm = (args: { payment: string | number | { id: string | number } } | [payment: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
        action: receipt.url(args, options),
        method: 'get',
    })

            /**
* @see \App\Http\Controllers\FinancingController::receipt
 * @see app/Http/Controllers/FinancingController.php:239
 * @route '/financing/payments/{payment}/receipt'
 */
        receiptForm.get = (args: { payment: string | number | { id: string | number } } | [payment: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: receipt.url(args, options),
            method: 'get',
        })
            /**
* @see \App\Http\Controllers\FinancingController::receipt
 * @see app/Http/Controllers/FinancingController.php:239
 * @route '/financing/payments/{payment}/receipt'
 */
        receiptForm.head = (args: { payment: string | number | { id: string | number } } | [payment: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: receipt.url(args, {
                        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
                            _method: 'HEAD',
                            ...(options?.query ?? options?.mergeQuery ?? {}),
                        }
                    }),
            method: 'get',
        })
    
    receipt.form = receiptForm
const payments = {
    record: Object.assign(record, record),
create: Object.assign(create, create),
history: Object.assign(history, history),
receipt: Object.assign(receipt, receipt),
}

export default payments