import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../wayfinder'
/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::index
* @see app/Http/Controllers/Admin/InvestmentManageController.php:29
* @route '/admin/inversiones'
*/
export const index = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

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

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::index
* @see app/Http/Controllers/Admin/InvestmentManageController.php:29
* @route '/admin/inversiones'
*/
index.url = (options?: RouteQueryOptions) => {
    return index.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::index
* @see app/Http/Controllers/Admin/InvestmentManageController.php:29
* @route '/admin/inversiones'
*/
index.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::index
* @see app/Http/Controllers/Admin/InvestmentManageController.php:29
* @route '/admin/inversiones'
*/
index.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: index.url(options),
    method: 'head',
})

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

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

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::index
* @see app/Http/Controllers/Admin/InvestmentManageController.php:29
* @route '/admin/inversiones'
*/
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\Admin\InvestmentManageController::accruals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:125
* @route '/admin/inversiones/{investment}/acreditaciones'
*/
export const accruals = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: accruals.url(args, options),
    method: 'get',
})

accruals.definition = {
    methods: ["get","head"],
    url: '/admin/inversiones/{investment}/acreditaciones',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::accruals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:125
* @route '/admin/inversiones/{investment}/acreditaciones'
*/
accruals.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 accruals.definition.url
            .replace('{investment}', parsedArgs.investment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::accruals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:125
* @route '/admin/inversiones/{investment}/acreditaciones'
*/
accruals.get = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: accruals.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::accruals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:125
* @route '/admin/inversiones/{investment}/acreditaciones'
*/
accruals.head = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: accruals.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::accruals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:125
* @route '/admin/inversiones/{investment}/acreditaciones'
*/
const accrualsForm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: accruals.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::accruals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:125
* @route '/admin/inversiones/{investment}/acreditaciones'
*/
accrualsForm.get = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: accruals.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::accruals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:125
* @route '/admin/inversiones/{investment}/acreditaciones'
*/
accrualsForm.head = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: accruals.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

accruals.form = accrualsForm

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::confirm
* @see app/Http/Controllers/Admin/InvestmentManageController.php:255
* @route '/admin/inversiones/{investment}/confirmar'
*/
export const confirm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: confirm.url(args, options),
    method: 'patch',
})

confirm.definition = {
    methods: ["patch"],
    url: '/admin/inversiones/{investment}/confirmar',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::confirm
* @see app/Http/Controllers/Admin/InvestmentManageController.php:255
* @route '/admin/inversiones/{investment}/confirmar'
*/
confirm.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 confirm.definition.url
            .replace('{investment}', parsedArgs.investment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::confirm
* @see app/Http/Controllers/Admin/InvestmentManageController.php:255
* @route '/admin/inversiones/{investment}/confirmar'
*/
confirm.patch = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: confirm.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::confirm
* @see app/Http/Controllers/Admin/InvestmentManageController.php:255
* @route '/admin/inversiones/{investment}/confirmar'
*/
const confirmForm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: confirm.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::confirm
* @see app/Http/Controllers/Admin/InvestmentManageController.php:255
* @route '/admin/inversiones/{investment}/confirmar'
*/
confirmForm.patch = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: confirm.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

confirm.form = confirmForm

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::voidMethod
* @see app/Http/Controllers/Admin/InvestmentManageController.php:304
* @route '/admin/inversiones/{investment}/anular'
*/
export const voidMethod = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: voidMethod.url(args, options),
    method: 'patch',
})

voidMethod.definition = {
    methods: ["patch"],
    url: '/admin/inversiones/{investment}/anular',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::voidMethod
* @see app/Http/Controllers/Admin/InvestmentManageController.php:304
* @route '/admin/inversiones/{investment}/anular'
*/
voidMethod.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 voidMethod.definition.url
            .replace('{investment}', parsedArgs.investment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::voidMethod
* @see app/Http/Controllers/Admin/InvestmentManageController.php:304
* @route '/admin/inversiones/{investment}/anular'
*/
voidMethod.patch = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: voidMethod.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::voidMethod
* @see app/Http/Controllers/Admin/InvestmentManageController.php:304
* @route '/admin/inversiones/{investment}/anular'
*/
const voidMethodForm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: voidMethod.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::voidMethod
* @see app/Http/Controllers/Admin/InvestmentManageController.php:304
* @route '/admin/inversiones/{investment}/anular'
*/
voidMethodForm.patch = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: voidMethod.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

voidMethod.form = voidMethodForm

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::reactivate
* @see app/Http/Controllers/Admin/InvestmentManageController.php:337
* @route '/admin/inversiones/{investment}/reactivar'
*/
export const reactivate = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: reactivate.url(args, options),
    method: 'patch',
})

reactivate.definition = {
    methods: ["patch"],
    url: '/admin/inversiones/{investment}/reactivar',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::reactivate
* @see app/Http/Controllers/Admin/InvestmentManageController.php:337
* @route '/admin/inversiones/{investment}/reactivar'
*/
reactivate.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 reactivate.definition.url
            .replace('{investment}', parsedArgs.investment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::reactivate
* @see app/Http/Controllers/Admin/InvestmentManageController.php:337
* @route '/admin/inversiones/{investment}/reactivar'
*/
reactivate.patch = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: reactivate.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::reactivate
* @see app/Http/Controllers/Admin/InvestmentManageController.php:337
* @route '/admin/inversiones/{investment}/reactivar'
*/
const reactivateForm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: reactivate.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::reactivate
* @see app/Http/Controllers/Admin/InvestmentManageController.php:337
* @route '/admin/inversiones/{investment}/reactivar'
*/
reactivateForm.patch = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: reactivate.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

reactivate.form = reactivateForm

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::finalize
* @see app/Http/Controllers/Admin/InvestmentManageController.php:372
* @route '/admin/inversiones/{investment}/finalizar'
*/
export const finalize = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: finalize.url(args, options),
    method: 'patch',
})

finalize.definition = {
    methods: ["patch"],
    url: '/admin/inversiones/{investment}/finalizar',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::finalize
* @see app/Http/Controllers/Admin/InvestmentManageController.php:372
* @route '/admin/inversiones/{investment}/finalizar'
*/
finalize.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 finalize.definition.url
            .replace('{investment}', parsedArgs.investment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::finalize
* @see app/Http/Controllers/Admin/InvestmentManageController.php:372
* @route '/admin/inversiones/{investment}/finalizar'
*/
finalize.patch = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: finalize.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::finalize
* @see app/Http/Controllers/Admin/InvestmentManageController.php:372
* @route '/admin/inversiones/{investment}/finalizar'
*/
const finalizeForm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: finalize.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::finalize
* @see app/Http/Controllers/Admin/InvestmentManageController.php:372
* @route '/admin/inversiones/{investment}/finalizar'
*/
finalizeForm.patch = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: finalize.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

finalize.form = finalizeForm

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::pendingReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:403
* @route '/admin/inversiones/{investment}/referidos-pendientes'
*/
export const pendingReferrals = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: pendingReferrals.url(args, options),
    method: 'get',
})

pendingReferrals.definition = {
    methods: ["get","head"],
    url: '/admin/inversiones/{investment}/referidos-pendientes',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::pendingReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:403
* @route '/admin/inversiones/{investment}/referidos-pendientes'
*/
pendingReferrals.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 pendingReferrals.definition.url
            .replace('{investment}', parsedArgs.investment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::pendingReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:403
* @route '/admin/inversiones/{investment}/referidos-pendientes'
*/
pendingReferrals.get = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: pendingReferrals.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::pendingReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:403
* @route '/admin/inversiones/{investment}/referidos-pendientes'
*/
pendingReferrals.head = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: pendingReferrals.url(args, options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::pendingReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:403
* @route '/admin/inversiones/{investment}/referidos-pendientes'
*/
const pendingReferralsForm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: pendingReferrals.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::pendingReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:403
* @route '/admin/inversiones/{investment}/referidos-pendientes'
*/
pendingReferralsForm.get = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: pendingReferrals.url(args, options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::pendingReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:403
* @route '/admin/inversiones/{investment}/referidos-pendientes'
*/
pendingReferralsForm.head = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: pendingReferrals.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'HEAD',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'get',
})

pendingReferrals.form = pendingReferralsForm

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::applyReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:437
* @route '/admin/inversiones/{investment}/referidos'
*/
export const applyReferrals = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: applyReferrals.url(args, options),
    method: 'post',
})

applyReferrals.definition = {
    methods: ["post"],
    url: '/admin/inversiones/{investment}/referidos',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::applyReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:437
* @route '/admin/inversiones/{investment}/referidos'
*/
applyReferrals.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 applyReferrals.definition.url
            .replace('{investment}', parsedArgs.investment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::applyReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:437
* @route '/admin/inversiones/{investment}/referidos'
*/
applyReferrals.post = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: applyReferrals.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::applyReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:437
* @route '/admin/inversiones/{investment}/referidos'
*/
const applyReferralsForm = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: applyReferrals.url(args, options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\InvestmentManageController::applyReferrals
* @see app/Http/Controllers/Admin/InvestmentManageController.php:437
* @route '/admin/inversiones/{investment}/referidos'
*/
applyReferralsForm.post = (args: { investment: number | { id: number } } | [investment: number | { id: number } ] | number | { id: number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: applyReferrals.url(args, options),
    method: 'post',
})

applyReferrals.form = applyReferralsForm

const investments = {
    index: Object.assign(index, index),
    accruals: Object.assign(accruals, accruals),
    confirm: Object.assign(confirm, confirm),
    void: Object.assign(voidMethod, voidMethod),
    reactivate: Object.assign(reactivate, reactivate),
    finalize: Object.assign(finalize, finalize),
    pendingReferrals: Object.assign(pendingReferrals, pendingReferrals),
    applyReferrals: Object.assign(applyReferrals, applyReferrals),
}

export default investments