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

index.definition = {
    methods: ["get","head"],
    url: '/app/settings/canned-replies',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::index
* @see app/Http/Controllers/Admin/CannedReplyController.php:25
* @route '/app/settings/canned-replies'
*/
index.url = (options?: RouteQueryOptions) => {
    return index.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::index
* @see app/Http/Controllers/Admin/CannedReplyController.php:25
* @route '/app/settings/canned-replies'
*/
index.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::index
* @see app/Http/Controllers/Admin/CannedReplyController.php:25
* @route '/app/settings/canned-replies'
*/
index.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: index.url(options),
    method: 'head',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::index
* @see app/Http/Controllers/Admin/CannedReplyController.php:25
* @route '/app/settings/canned-replies'
*/
const indexForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::index
* @see app/Http/Controllers/Admin/CannedReplyController.php:25
* @route '/app/settings/canned-replies'
*/
indexForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
    action: index.url(options),
    method: 'get',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::index
* @see app/Http/Controllers/Admin/CannedReplyController.php:25
* @route '/app/settings/canned-replies'
*/
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\CannedReplyController::store
* @see app/Http/Controllers/Admin/CannedReplyController.php:49
* @route '/app/settings/canned-replies'
*/
export const store = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

store.definition = {
    methods: ["post"],
    url: '/app/settings/canned-replies',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::store
* @see app/Http/Controllers/Admin/CannedReplyController.php:49
* @route '/app/settings/canned-replies'
*/
store.url = (options?: RouteQueryOptions) => {
    return store.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::store
* @see app/Http/Controllers/Admin/CannedReplyController.php:49
* @route '/app/settings/canned-replies'
*/
store.post = (options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: store.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::store
* @see app/Http/Controllers/Admin/CannedReplyController.php:49
* @route '/app/settings/canned-replies'
*/
const storeForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: store.url(options),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::store
* @see app/Http/Controllers/Admin/CannedReplyController.php:49
* @route '/app/settings/canned-replies'
*/
storeForm.post = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: store.url(options),
    method: 'post',
})

store.form = storeForm

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::reorder
* @see app/Http/Controllers/Admin/CannedReplyController.php:90
* @route '/app/settings/canned-replies/reorder'
*/
export const reorder = (options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: reorder.url(options),
    method: 'patch',
})

reorder.definition = {
    methods: ["patch"],
    url: '/app/settings/canned-replies/reorder',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::reorder
* @see app/Http/Controllers/Admin/CannedReplyController.php:90
* @route '/app/settings/canned-replies/reorder'
*/
reorder.url = (options?: RouteQueryOptions) => {
    return reorder.definition.url + queryParams(options)
}

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::reorder
* @see app/Http/Controllers/Admin/CannedReplyController.php:90
* @route '/app/settings/canned-replies/reorder'
*/
reorder.patch = (options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: reorder.url(options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::reorder
* @see app/Http/Controllers/Admin/CannedReplyController.php:90
* @route '/app/settings/canned-replies/reorder'
*/
const reorderForm = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: reorder.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::reorder
* @see app/Http/Controllers/Admin/CannedReplyController.php:90
* @route '/app/settings/canned-replies/reorder'
*/
reorderForm.patch = (options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: reorder.url({
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

reorder.form = reorderForm

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::update
* @see app/Http/Controllers/Admin/CannedReplyController.php:68
* @route '/app/settings/canned-replies/{cannedReply}'
*/
export const update = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: update.url(args, options),
    method: 'patch',
})

update.definition = {
    methods: ["patch"],
    url: '/app/settings/canned-replies/{cannedReply}',
} satisfies RouteDefinition<["patch"]>

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::update
* @see app/Http/Controllers/Admin/CannedReplyController.php:68
* @route '/app/settings/canned-replies/{cannedReply}'
*/
update.url = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { cannedReply: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::update
* @see app/Http/Controllers/Admin/CannedReplyController.php:68
* @route '/app/settings/canned-replies/{cannedReply}'
*/
update.patch = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteDefinition<'patch'> => ({
    url: update.url(args, options),
    method: 'patch',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::update
* @see app/Http/Controllers/Admin/CannedReplyController.php:68
* @route '/app/settings/canned-replies/{cannedReply}'
*/
const updateForm = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: update.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::update
* @see app/Http/Controllers/Admin/CannedReplyController.php:68
* @route '/app/settings/canned-replies/{cannedReply}'
*/
updateForm.patch = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
    action: update.url(args, {
        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
            _method: 'PATCH',
            ...(options?.query ?? options?.mergeQuery ?? {}),
        }
    }),
    method: 'post',
})

update.form = updateForm

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::destroy
* @see app/Http/Controllers/Admin/CannedReplyController.php:106
* @route '/app/settings/canned-replies/{cannedReply}'
*/
export const destroy = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: 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: '/app/settings/canned-replies/{cannedReply}',
} satisfies RouteDefinition<["delete"]>

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::destroy
* @see app/Http/Controllers/Admin/CannedReplyController.php:106
* @route '/app/settings/canned-replies/{cannedReply}'
*/
destroy.url = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: string | number | { id: string | number } ] | string | number | { id: string | number }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { cannedReply: args }
    }

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

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

    args = applyUrlDefaults(args)

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

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

/**
* @see \App\Http\Controllers\Admin\CannedReplyController::destroy
* @see app/Http/Controllers/Admin/CannedReplyController.php:106
* @route '/app/settings/canned-replies/{cannedReply}'
*/
destroy.delete = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: 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\Admin\CannedReplyController::destroy
* @see app/Http/Controllers/Admin/CannedReplyController.php:106
* @route '/app/settings/canned-replies/{cannedReply}'
*/
const destroyForm = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: 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\Admin\CannedReplyController::destroy
* @see app/Http/Controllers/Admin/CannedReplyController.php:106
* @route '/app/settings/canned-replies/{cannedReply}'
*/
destroyForm.delete = (args: { cannedReply: string | number | { id: string | number } } | [cannedReply: 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

const CannedReplyController = { index, store, reorder, update, destroy }

export default CannedReplyController