import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../wayfinder'
/**
* @see \App\Http\Controllers\MyInvestmentsController::mine
* @see app/Http/Controllers/MyInvestmentsController.php:15
* @route '/mis-inversiones'
*/
export const mine = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: mine.url(options),
    method: 'get',
})

mine.definition = {
    methods: ["get","head"],
    url: '/mis-inversiones',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\MyInvestmentsController::mine
* @see app/Http/Controllers/MyInvestmentsController.php:15
* @route '/mis-inversiones'
*/
mine.url = (options?: RouteQueryOptions) => {
    return mine.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\MyInvestmentsController::mine
* @see app/Http/Controllers/MyInvestmentsController.php:15
* @route '/mis-inversiones'
*/
mine.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: mine.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\MyInvestmentsController::mine
* @see app/Http/Controllers/MyInvestmentsController.php:15
* @route '/mis-inversiones'
*/
mine.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: mine.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\MyInvestmentsController::mine
* @see app/Http/Controllers/MyInvestmentsController.php:15
* @route '/mis-inversiones'
*/
const mineForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: mine.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\MyInvestmentsController::mine
* @see app/Http/Controllers/MyInvestmentsController.php:15
* @route '/mis-inversiones'
*/
mineForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: mine.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\MyInvestmentsController::mine
* @see app/Http/Controllers/MyInvestmentsController.php:15
* @route '/mis-inversiones'
*/
mineForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: mine.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

mine.form = mineForm

/**
* @see \App\Http\Controllers\InvestmentTransactionsController::transactions
* @see app/Http/Controllers/InvestmentTransactionsController.php:17
* @route '/mis-inversiones/{investment}/movimientos'
*/
export const transactions = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: transactions.url(args, options),
    method: 'get',
})

transactions.definition = {
    methods: ["get","head"],
    url: '/mis-inversiones/{investment}/movimientos',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\InvestmentTransactionsController::transactions
* @see app/Http/Controllers/InvestmentTransactionsController.php:17
* @route '/mis-inversiones/{investment}/movimientos'
*/
transactions.url = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { investment: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\InvestmentTransactionsController::transactions
* @see app/Http/Controllers/InvestmentTransactionsController.php:17
* @route '/mis-inversiones/{investment}/movimientos'
*/
transactions.get = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: transactions.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\InvestmentTransactionsController::transactions
* @see app/Http/Controllers/InvestmentTransactionsController.php:17
* @route '/mis-inversiones/{investment}/movimientos'
*/
transactions.head = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: transactions.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\InvestmentTransactionsController::transactions
* @see app/Http/Controllers/InvestmentTransactionsController.php:17
* @route '/mis-inversiones/{investment}/movimientos'
*/
const transactionsForm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: transactions.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\InvestmentTransactionsController::transactions
* @see app/Http/Controllers/InvestmentTransactionsController.php:17
* @route '/mis-inversiones/{investment}/movimientos'
*/
transactionsForm.get = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: transactions.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\InvestmentTransactionsController::transactions
* @see app/Http/Controllers/InvestmentTransactionsController.php:17
* @route '/mis-inversiones/{investment}/movimientos'
*/
transactionsForm.head = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: 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\InvestmentController::index
* @see app/Http/Controllers/InvestmentController.php:21
* @route '/invertir'
*/
export const index = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

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

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

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

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

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

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

/**
* @see \App\Http\Controllers\InvestmentController::index
* @see app/Http/Controllers/InvestmentController.php:21
* @route '/invertir'
*/
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\InvestmentController::store
* @see app/Http/Controllers/InvestmentController.php:40
* @route '/invertir'
*/
export const store = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

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

/**
* @see \App\Http\Controllers\InvestmentController::store
* @see app/Http/Controllers/InvestmentController.php:40
* @route '/invertir'
*/
store.url = (options?: RouteQueryOptions) => {
    return store.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\InvestmentController::store
* @see app/Http/Controllers/InvestmentController.php:40
* @route '/invertir'
*/
store.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

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

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

store.form = storeForm

const investments = {
    mine: Object.assign(mine, mine),
    transactions: Object.assign(transactions, transactions),
    index: Object.assign(index, index),
    store: Object.assign(store, store),
}

export default investments