// This file is auto-generated by @hey-api/openapi-ts

import type { Client, Options as Options2, TDataShape } from './client';
import { client } from './client.gen';
import type { SerenAgentCapabilitiesData, SerenAgentCapabilitiesResponses, SerenAgentDeleteManagedDeploymentData, SerenAgentDeleteManagedDeploymentErrors, SerenAgentDeleteManagedDeploymentResponses, SerenAgentDeployData, SerenAgentDeployErrors, SerenAgentDeployResponses, SerenAgentGetManagedDeploymentData, SerenAgentGetManagedDeploymentErrors, SerenAgentGetManagedDeploymentResponses, SerenAgentListDeploymentsData, SerenAgentListDeploymentsErrors, SerenAgentListDeploymentsResponses, SerenAgentListManagedDeploymentRevisionsData, SerenAgentListManagedDeploymentRevisionsErrors, SerenAgentListManagedDeploymentRevisionsResponses, SerenAgentPatchManagedDeploymentFilesData, SerenAgentPatchManagedDeploymentFilesErrors, SerenAgentPatchManagedDeploymentFilesResponses, SerenAgentPreviewManagedDeploymentRollbackData, SerenAgentPreviewManagedDeploymentRollbackErrors, SerenAgentPreviewManagedDeploymentRollbackResponses, SerenAgentPreviewManagedDeploymentUpdateData, SerenAgentPreviewManagedDeploymentUpdateErrors, SerenAgentPreviewManagedDeploymentUpdateResponses, SerenAgentPrivateModelsData, SerenAgentPrivateModelsResponses, SerenAgentRollbackManagedDeploymentData, SerenAgentRollbackManagedDeploymentErrors, SerenAgentRollbackManagedDeploymentResponses, SerenAgentStartManagedDeploymentData, SerenAgentStartManagedDeploymentErrors, SerenAgentStartManagedDeploymentResponses, SerenAgentStopManagedDeploymentData, SerenAgentStopManagedDeploymentErrors, SerenAgentStopManagedDeploymentResponses, SerenAgentTestRunData, SerenAgentTestRunErrors, SerenAgentTestRunResponses, SerenAgentUpdateManagedDeploymentData, SerenAgentUpdateManagedDeploymentErrors, SerenAgentUpdateManagedDeploymentResponses } from './types.gen';

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
    /**
     * You can provide a client instance returned by `createClient()` instead of
     * individual options. This might be also useful if you want to implement a
     * custom client.
     */
    client?: Client;
    /**
     * You can pass arbitrary values through the `meta` object. This can be
     * used to access values that aren't defined as part of the SDK function.
     */
    meta?: Record<string, unknown>;
};

/**
 * Inspect available orchestration features and runtime limits.
 */
export const serenAgentCapabilities = <ThrowOnError extends boolean = false>(options?: Options<SerenAgentCapabilitiesData, ThrowOnError>) => (options?.client ?? client).get<SerenAgentCapabilitiesResponses, unknown, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/capabilities',
    ...options
});

/**
 * Create or update an orchestrated deployment (forwarded to seren-cloud).
 */
export const serenAgentDeploy = <ThrowOnError extends boolean = false>(options: Options<SerenAgentDeployData, ThrowOnError>) => (options.client ?? client).post<SerenAgentDeployResponses, SerenAgentDeployErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deploy',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * List orchestrated deployments and their runtime metadata.
 */
export const serenAgentListDeployments = <ThrowOnError extends boolean = false>(options?: Options<SerenAgentListDeploymentsData, ThrowOnError>) => (options?.client ?? client).get<SerenAgentListDeploymentsResponses, SerenAgentListDeploymentsErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments',
    ...options
});

/**
 * Delete a managed seren-agent deployment and clean up runtime resources.
 */
export const serenAgentDeleteManagedDeployment = <ThrowOnError extends boolean = false>(options: Options<SerenAgentDeleteManagedDeploymentData, ThrowOnError>) => (options.client ?? client).delete<SerenAgentDeleteManagedDeploymentResponses, SerenAgentDeleteManagedDeploymentErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}',
    ...options
});

/**
 * Get the resolved managed spec for a seren-agent deployment.
 */
export const serenAgentGetManagedDeployment = <ThrowOnError extends boolean = false>(options: Options<SerenAgentGetManagedDeploymentData, ThrowOnError>) => (options.client ?? client).get<SerenAgentGetManagedDeploymentResponses, SerenAgentGetManagedDeploymentErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/managed',
    ...options
});

/**
 * Update the editable managed spec for a seren-agent deployment.
 */
export const serenAgentUpdateManagedDeployment = <ThrowOnError extends boolean = false>(options: Options<SerenAgentUpdateManagedDeploymentData, ThrowOnError>) => (options.client ?? client).patch<SerenAgentUpdateManagedDeploymentResponses, SerenAgentUpdateManagedDeploymentErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/managed',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * Update files for a managed deployment.
 */
export const serenAgentPatchManagedDeploymentFiles = <ThrowOnError extends boolean = false>(options: Options<SerenAgentPatchManagedDeploymentFilesData, ThrowOnError>) => (options.client ?? client).patch<SerenAgentPatchManagedDeploymentFilesResponses, SerenAgentPatchManagedDeploymentFilesErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/managed/files',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * Preview a managed update before applying it.
 */
export const serenAgentPreviewManagedDeploymentUpdate = <ThrowOnError extends boolean = false>(options: Options<SerenAgentPreviewManagedDeploymentUpdateData, ThrowOnError>) => (options.client ?? client).post<SerenAgentPreviewManagedDeploymentUpdateResponses, SerenAgentPreviewManagedDeploymentUpdateErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/managed/preview',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * List immutable revision snapshots for a managed deployment.
 */
export const serenAgentListManagedDeploymentRevisions = <ThrowOnError extends boolean = false>(options: Options<SerenAgentListManagedDeploymentRevisionsData, ThrowOnError>) => (options.client ?? client).get<SerenAgentListManagedDeploymentRevisionsResponses, SerenAgentListManagedDeploymentRevisionsErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/managed/revisions',
    ...options
});

/**
 * Roll a managed deployment back to a prior revision.
 */
export const serenAgentRollbackManagedDeployment = <ThrowOnError extends boolean = false>(options: Options<SerenAgentRollbackManagedDeploymentData, ThrowOnError>) => (options.client ?? client).post<SerenAgentRollbackManagedDeploymentResponses, SerenAgentRollbackManagedDeploymentErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/managed/rollback',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * Preview rolling a managed deployment back to a prior revision.
 */
export const serenAgentPreviewManagedDeploymentRollback = <ThrowOnError extends boolean = false>(options: Options<SerenAgentPreviewManagedDeploymentRollbackData, ThrowOnError>) => (options.client ?? client).post<SerenAgentPreviewManagedDeploymentRollbackResponses, SerenAgentPreviewManagedDeploymentRollbackErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/managed/rollback/preview',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * Start a managed seren-agent deployment.
 */
export const serenAgentStartManagedDeployment = <ThrowOnError extends boolean = false>(options: Options<SerenAgentStartManagedDeploymentData, ThrowOnError>) => (options.client ?? client).post<SerenAgentStartManagedDeploymentResponses, SerenAgentStartManagedDeploymentErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/start',
    ...options
});

/**
 * Stop a managed seren-agent deployment.
 */
export const serenAgentStopManagedDeployment = <ThrowOnError extends boolean = false>(options: Options<SerenAgentStopManagedDeploymentData, ThrowOnError>) => (options.client ?? client).post<SerenAgentStopManagedDeploymentResponses, SerenAgentStopManagedDeploymentErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/deployments/{id}/stop',
    ...options
});

/**
 * List the private model catalog available through seren-private-models.
 */
export const serenAgentPrivateModels = <ThrowOnError extends boolean = false>(options?: Options<SerenAgentPrivateModelsData, ThrowOnError>) => (options?.client ?? client).get<SerenAgentPrivateModelsResponses, unknown, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/private-models',
    ...options
});

/**
 * Run an unsaved managed seren-agent draft once before deploying.
 */
export const serenAgentTestRun = <ThrowOnError extends boolean = false>(options: Options<SerenAgentTestRunData, ThrowOnError>) => (options.client ?? client).post<SerenAgentTestRunResponses, SerenAgentTestRunErrors, ThrowOnError>({
    security: [{ scheme: 'bearer', type: 'http' }],
    url: '/test-run',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});
