import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../wayfinder'
import transactionsBbd80d from './transactions'
import exportMethod from './export'
/**
* @see \App\Http\Controllers\SavingsController::index
 * @see app/Http/Controllers/SavingsController.php:32
 * @route '/savings'
 */
export const index = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

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

/**
* @see \App\Http\Controllers\SavingsController::index
 * @see app/Http/Controllers/SavingsController.php:32
 * @route '/savings'
 */
index.url = (options?: RouteQueryOptions) => {
    return index.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\SavingsController::index
 * @see app/Http/Controllers/SavingsController.php:32
 * @route '/savings'
 */
index.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})
/**
* @see \App\Http\Controllers\SavingsController::index
 * @see app/Http/Controllers/SavingsController.php:32
 * @route '/savings'
 */
index.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: index.url(options),
    method: 'head',
})

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

            /**
* @see \App\Http\Controllers\SavingsController::index
 * @see app/Http/Controllers/SavingsController.php:32
 * @route '/savings'
 */
        indexForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: index.url(options),
            method: 'get',
        })
            /**
* @see \App\Http\Controllers\SavingsController::index
 * @see app/Http/Controllers/SavingsController.php:32
 * @route '/savings'
 */
        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\SavingsController::open
 * @see app/Http/Controllers/SavingsController.php:151
 * @route '/savings/open'
 */
export const open = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: open.url(options),
    method: 'post',
})

open.definition = {
    methods: ["post"],
    url: '/savings/open',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\SavingsController::open
 * @see app/Http/Controllers/SavingsController.php:151
 * @route '/savings/open'
 */
open.url = (options?: RouteQueryOptions) => {
    return open.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\SavingsController::open
 * @see app/Http/Controllers/SavingsController.php:151
 * @route '/savings/open'
 */
open.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: open.url(options),
    method: 'post',
})

    /**
* @see \App\Http\Controllers\SavingsController::open
 * @see app/Http/Controllers/SavingsController.php:151
 * @route '/savings/open'
 */
    const openForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: open.url(options),
        method: 'post',
    })

            /**
* @see \App\Http\Controllers\SavingsController::open
 * @see app/Http/Controllers/SavingsController.php:151
 * @route '/savings/open'
 */
        openForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: open.url(options),
            method: 'post',
        })
    
    open.form = openForm
/**
* @see \App\Http\Controllers\SavingsController::show
 * @see app/Http/Controllers/SavingsController.php:66
 * @route '/savings/{account}'
 */
export const show = (args: { account: string | number | { id: string | number } } | [account: 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: '/savings/{account}',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\SavingsController::show
 * @see app/Http/Controllers/SavingsController.php:66
 * @route '/savings/{account}'
 */
show.url = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { account: args }
    }

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\SavingsController::show
 * @see app/Http/Controllers/SavingsController.php:66
 * @route '/savings/{account}'
 */
show.get = (args: { account: string | number | { id: string | number } } | [account: 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\SavingsController::show
 * @see app/Http/Controllers/SavingsController.php:66
 * @route '/savings/{account}'
 */
show.head = (args: { account: string | number | { id: string | number } } | [account: 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\SavingsController::show
 * @see app/Http/Controllers/SavingsController.php:66
 * @route '/savings/{account}'
 */
    const showForm = (args: { account: string | number | { id: string | number } } | [account: 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\SavingsController::show
 * @see app/Http/Controllers/SavingsController.php:66
 * @route '/savings/{account}'
 */
        showForm.get = (args: { account: string | number | { id: string | number } } | [account: 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\SavingsController::show
 * @see app/Http/Controllers/SavingsController.php:66
 * @route '/savings/{account}'
 */
        showForm.head = (args: { account: string | number | { id: string | number } } | [account: 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\SavingsController::transactions
 * @see app/Http/Controllers/SavingsController.php:83
 * @route '/savings/{account}/transactions'
 */
export const transactions = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: transactions.url(args, options),
    method: 'get',
})

transactions.definition = {
    methods: ["get","head"],
    url: '/savings/{account}/transactions',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\SavingsController::transactions
 * @see app/Http/Controllers/SavingsController.php:83
 * @route '/savings/{account}/transactions'
 */
transactions.url = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { account: args }
    }

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\SavingsController::transactions
 * @see app/Http/Controllers/SavingsController.php:83
 * @route '/savings/{account}/transactions'
 */
transactions.get = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: transactions.url(args, options),
    method: 'get',
})
/**
* @see \App\Http\Controllers\SavingsController::transactions
 * @see app/Http/Controllers/SavingsController.php:83
 * @route '/savings/{account}/transactions'
 */
transactions.head = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: transactions.url(args, options),
    method: 'head',
})

    /**
* @see \App\Http\Controllers\SavingsController::transactions
 * @see app/Http/Controllers/SavingsController.php:83
 * @route '/savings/{account}/transactions'
 */
    const transactionsForm = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
        action: transactions.url(args, options),
        method: 'get',
    })

            /**
* @see \App\Http\Controllers\SavingsController::transactions
 * @see app/Http/Controllers/SavingsController.php:83
 * @route '/savings/{account}/transactions'
 */
        transactionsForm.get = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: transactions.url(args, options),
            method: 'get',
        })
            /**
* @see \App\Http\Controllers\SavingsController::transactions
 * @see app/Http/Controllers/SavingsController.php:83
 * @route '/savings/{account}/transactions'
 */
        transactionsForm.head = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: transactions.url(args, {
                        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
                            _method: 'HEAD',
                            ...(options?.query ?? options?.mergeQuery ?? {}),
                        }
                    }),
            method: 'get',
        })
    
    transactions.form = transactionsForm
/**
* @see \App\Http\Controllers\SavingsController::deposit
 * @see app/Http/Controllers/SavingsController.php:96
 * @route '/savings/deposit'
 */
export const deposit = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: deposit.url(options),
    method: 'post',
})

deposit.definition = {
    methods: ["post"],
    url: '/savings/deposit',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\SavingsController::deposit
 * @see app/Http/Controllers/SavingsController.php:96
 * @route '/savings/deposit'
 */
deposit.url = (options?: RouteQueryOptions) => {
    return deposit.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\SavingsController::deposit
 * @see app/Http/Controllers/SavingsController.php:96
 * @route '/savings/deposit'
 */
deposit.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: deposit.url(options),
    method: 'post',
})

    /**
* @see \App\Http\Controllers\SavingsController::deposit
 * @see app/Http/Controllers/SavingsController.php:96
 * @route '/savings/deposit'
 */
    const depositForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: deposit.url(options),
        method: 'post',
    })

            /**
* @see \App\Http\Controllers\SavingsController::deposit
 * @see app/Http/Controllers/SavingsController.php:96
 * @route '/savings/deposit'
 */
        depositForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: deposit.url(options),
            method: 'post',
        })
    
    deposit.form = depositForm
/**
* @see \App\Http\Controllers\SavingsController::withdraw
 * @see app/Http/Controllers/SavingsController.php:118
 * @route '/savings/withdraw'
 */
export const withdraw = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: withdraw.url(options),
    method: 'post',
})

withdraw.definition = {
    methods: ["post"],
    url: '/savings/withdraw',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\SavingsController::withdraw
 * @see app/Http/Controllers/SavingsController.php:118
 * @route '/savings/withdraw'
 */
withdraw.url = (options?: RouteQueryOptions) => {
    return withdraw.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\SavingsController::withdraw
 * @see app/Http/Controllers/SavingsController.php:118
 * @route '/savings/withdraw'
 */
withdraw.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: withdraw.url(options),
    method: 'post',
})

    /**
* @see \App\Http\Controllers\SavingsController::withdraw
 * @see app/Http/Controllers/SavingsController.php:118
 * @route '/savings/withdraw'
 */
    const withdrawForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: withdraw.url(options),
        method: 'post',
    })

            /**
* @see \App\Http\Controllers\SavingsController::withdraw
 * @see app/Http/Controllers/SavingsController.php:118
 * @route '/savings/withdraw'
 */
        withdrawForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: withdraw.url(options),
            method: 'post',
        })
    
    withdraw.form = withdrawForm
/**
* @see \App\Http\Controllers\SavingsController::close
 * @see app/Http/Controllers/SavingsController.php:174
 * @route '/savings/{account}/close'
 */
export const close = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: close.url(args, options),
    method: 'post',
})

close.definition = {
    methods: ["post"],
    url: '/savings/{account}/close',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\SavingsController::close
 * @see app/Http/Controllers/SavingsController.php:174
 * @route '/savings/{account}/close'
 */
close.url = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { account: args }
    }

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\SavingsController::close
 * @see app/Http/Controllers/SavingsController.php:174
 * @route '/savings/{account}/close'
 */
close.post = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: close.url(args, options),
    method: 'post',
})

    /**
* @see \App\Http\Controllers\SavingsController::close
 * @see app/Http/Controllers/SavingsController.php:174
 * @route '/savings/{account}/close'
 */
    const closeForm = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: close.url(args, options),
        method: 'post',
    })

            /**
* @see \App\Http\Controllers\SavingsController::close
 * @see app/Http/Controllers/SavingsController.php:174
 * @route '/savings/{account}/close'
 */
        closeForm.post = (args: { account: string | number | { id: string | number } } | [account: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: close.url(args, options),
            method: 'post',
        })
    
    close.form = closeForm
const savings = {
    index: Object.assign(index, index),
open: Object.assign(open, open),
show: Object.assign(show, show),
transactions: Object.assign(transactions, transactionsBbd80d),
deposit: Object.assign(deposit, deposit),
withdraw: Object.assign(withdraw, withdraw),
close: Object.assign(close, close),
export: Object.assign(exportMethod, exportMethod),
}

export default savings