import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../wayfinder'
import files from './files'
/**
* @see \App\Http\Controllers\PublicInspectionController::show
 * @see app/Http/Controllers/PublicInspectionController.php:35
 * @route '/inspection/{report}'
 */
export const show = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})

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

/**
* @see \App\Http\Controllers\PublicInspectionController::show
 * @see app/Http/Controllers/PublicInspectionController.php:35
 * @route '/inspection/{report}'
 */
show.url = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { report: args }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
                        report: typeof args.report === 'object'
                ? args.report.token
                : args.report,
                }

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

/**
* @see \App\Http\Controllers\PublicInspectionController::show
 * @see app/Http/Controllers/PublicInspectionController.php:35
 * @route '/inspection/{report}'
 */
show.get = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: show.url(args, options),
    method: 'get',
})
/**
* @see \App\Http\Controllers\PublicInspectionController::show
 * @see app/Http/Controllers/PublicInspectionController.php:35
 * @route '/inspection/{report}'
 */
show.head = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: show.url(args, options),
    method: 'head',
})

    /**
* @see \App\Http\Controllers\PublicInspectionController::show
 * @see app/Http/Controllers/PublicInspectionController.php:35
 * @route '/inspection/{report}'
 */
    const showForm = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
        action: show.url(args, options),
        method: 'get',
    })

            /**
* @see \App\Http\Controllers\PublicInspectionController::show
 * @see app/Http/Controllers/PublicInspectionController.php:35
 * @route '/inspection/{report}'
 */
        showForm.get = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: show.url(args, options),
            method: 'get',
        })
            /**
* @see \App\Http\Controllers\PublicInspectionController::show
 * @see app/Http/Controllers/PublicInspectionController.php:35
 * @route '/inspection/{report}'
 */
        showForm.head = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, 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\PublicInspectionController::submit
 * @see app/Http/Controllers/PublicInspectionController.php:58
 * @route '/inspection/{report}'
 */
export const submit = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: submit.url(args, options),
    method: 'post',
})

submit.definition = {
    methods: ["post"],
    url: '/inspection/{report}',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\PublicInspectionController::submit
 * @see app/Http/Controllers/PublicInspectionController.php:58
 * @route '/inspection/{report}'
 */
submit.url = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { report: args }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
                        report: typeof args.report === 'object'
                ? args.report.token
                : args.report,
                }

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

/**
* @see \App\Http\Controllers\PublicInspectionController::submit
 * @see app/Http/Controllers/PublicInspectionController.php:58
 * @route '/inspection/{report}'
 */
submit.post = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: submit.url(args, options),
    method: 'post',
})

    /**
* @see \App\Http\Controllers\PublicInspectionController::submit
 * @see app/Http/Controllers/PublicInspectionController.php:58
 * @route '/inspection/{report}'
 */
    const submitForm = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: submit.url(args, options),
        method: 'post',
    })

            /**
* @see \App\Http\Controllers\PublicInspectionController::submit
 * @see app/Http/Controllers/PublicInspectionController.php:58
 * @route '/inspection/{report}'
 */
        submitForm.post = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: submit.url(args, options),
            method: 'post',
        })
    
    submit.form = submitForm
/**
* @see \App\Http\Controllers\PublicInspectionController::draft
 * @see app/Http/Controllers/PublicInspectionController.php:84
 * @route '/inspection/{report}/draft'
 */
export const draft = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: draft.url(args, options),
    method: 'post',
})

draft.definition = {
    methods: ["post"],
    url: '/inspection/{report}/draft',
} satisfies RouteDefinition<["post"]>

/**
* @see \App\Http\Controllers\PublicInspectionController::draft
 * @see app/Http/Controllers/PublicInspectionController.php:84
 * @route '/inspection/{report}/draft'
 */
draft.url = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions) => {
    if (typeof args === 'string' || typeof args === 'number') {
        args = { report: args }
    }

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

    args = applyUrlDefaults(args)

    const parsedArgs = {
                        report: typeof args.report === 'object'
                ? args.report.token
                : args.report,
                }

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

/**
* @see \App\Http\Controllers\PublicInspectionController::draft
 * @see app/Http/Controllers/PublicInspectionController.php:84
 * @route '/inspection/{report}/draft'
 */
draft.post = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteDefinition<'post'> => ({
    url: draft.url(args, options),
    method: 'post',
})

    /**
* @see \App\Http\Controllers\PublicInspectionController::draft
 * @see app/Http/Controllers/PublicInspectionController.php:84
 * @route '/inspection/{report}/draft'
 */
    const draftForm = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
        action: draft.url(args, options),
        method: 'post',
    })

            /**
* @see \App\Http\Controllers\PublicInspectionController::draft
 * @see app/Http/Controllers/PublicInspectionController.php:84
 * @route '/inspection/{report}/draft'
 */
        draftForm.post = (args: { report: string | { token: string } } | [report: string | { token: string } ] | string | { token: string }, options?: RouteQueryOptions): RouteFormDefinition<'post'> => ({
            action: draft.url(args, options),
            method: 'post',
        })
    
    draft.form = draftForm
/**
* @see \App\Http\Controllers\PublicInspectionController::file
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}'
 */
export const file = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: file.url(args, options),
    method: 'get',
})

file.definition = {
    methods: ["get","head"],
    url: '/inspection/{report}/files/{attachment}',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\PublicInspectionController::file
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}'
 */
file.url = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions) => {
    if (Array.isArray(args)) {
        args = {
                    report: args[0],
                    attachment: args[1],
                }
    }

    args = applyUrlDefaults(args)

    const parsedArgs = {
                        report: typeof args.report === 'object'
                ? args.report.token
                : args.report,
                                attachment: typeof args.attachment === 'object'
                ? args.attachment.id
                : args.attachment,
                }

    return file.definition.url
            .replace('{report}', parsedArgs.report.toString())
            .replace('{attachment}', parsedArgs.attachment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\PublicInspectionController::file
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}'
 */
file.get = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: file.url(args, options),
    method: 'get',
})
/**
* @see \App\Http\Controllers\PublicInspectionController::file
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}'
 */
file.head = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: file.url(args, options),
    method: 'head',
})

    /**
* @see \App\Http\Controllers\PublicInspectionController::file
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}'
 */
    const fileForm = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
        action: file.url(args, options),
        method: 'get',
    })

            /**
* @see \App\Http\Controllers\PublicInspectionController::file
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}'
 */
        fileForm.get = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: file.url(args, options),
            method: 'get',
        })
            /**
* @see \App\Http\Controllers\PublicInspectionController::file
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}'
 */
        fileForm.head = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: file.url(args, {
                        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
                            _method: 'HEAD',
                            ...(options?.query ?? options?.mergeQuery ?? {}),
                        }
                    }),
            method: 'get',
        })
    
    file.form = fileForm
/**
* @see \App\Http\Controllers\PublicInspectionController::download
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}/download'
 */
export const download = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: download.url(args, options),
    method: 'get',
})

download.definition = {
    methods: ["get","head"],
    url: '/inspection/{report}/files/{attachment}/download',
} satisfies RouteDefinition<["get","head"]>

/**
* @see \App\Http\Controllers\PublicInspectionController::download
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}/download'
 */
download.url = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions) => {
    if (Array.isArray(args)) {
        args = {
                    report: args[0],
                    attachment: args[1],
                }
    }

    args = applyUrlDefaults(args)

    const parsedArgs = {
                        report: typeof args.report === 'object'
                ? args.report.token
                : args.report,
                                attachment: typeof args.attachment === 'object'
                ? args.attachment.id
                : args.attachment,
                }

    return download.definition.url
            .replace('{report}', parsedArgs.report.toString())
            .replace('{attachment}', parsedArgs.attachment.toString())
            .replace(/\/+$/, '') + queryParams(options)
}

/**
* @see \App\Http\Controllers\PublicInspectionController::download
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}/download'
 */
download.get = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    url: download.url(args, options),
    method: 'get',
})
/**
* @see \App\Http\Controllers\PublicInspectionController::download
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}/download'
 */
download.head = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteDefinition<'head'> => ({
    url: download.url(args, options),
    method: 'head',
})

    /**
* @see \App\Http\Controllers\PublicInspectionController::download
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}/download'
 */
    const downloadForm = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
        action: download.url(args, options),
        method: 'get',
    })

            /**
* @see \App\Http\Controllers\PublicInspectionController::download
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}/download'
 */
        downloadForm.get = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: download.url(args, options),
            method: 'get',
        })
            /**
* @see \App\Http\Controllers\PublicInspectionController::download
 * @see app/Http/Controllers/PublicInspectionController.php:146
 * @route '/inspection/{report}/files/{attachment}/download'
 */
        downloadForm.head = (args: { report: string | { token: string }, attachment: number | { id: number } } | [report: string | { token: string }, attachment: number | { id: number } ], options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
            action: download.url(args, {
                        [options?.mergeQuery ? 'mergeQuery' : 'query']: {
                            _method: 'HEAD',
                            ...(options?.query ?? options?.mergeQuery ?? {}),
                        }
                    }),
            method: 'get',
        })
    
    download.form = downloadForm
const publicMethod = {
    show: Object.assign(show, show),
submit: Object.assign(submit, submit),
draft: Object.assign(draft, draft),
files: Object.assign(files, files),
file: Object.assign(file, file),
download: Object.assign(download, download),
}

export default publicMethod