// This file was auto-generated by Fern from our API Definition.

import { VapiClient } from "../../src/Client";
import { mockServerPool } from "../mock-server/MockServerPool";

describe("StructuredOutputsClient", () => {
    test("StructuredOutputController_findAll", async () => {
        const server = mockServerPool.createServer();
        const client = new VapiClient({ maxRetries: 0, token: "test", environment: server.baseUrl });

        const rawResponseBody = {
            results: [
                {
                    type: "ai",
                    regex: "regex",
                    model: { provider: "openai", model: "gpt-5.4" },
                    compliancePlan: { forceStoreOnHipaaEnabled: false },
                    id: "id",
                    orgId: "orgId",
                    createdAt: "2024-01-15T09:30:00Z",
                    updatedAt: "2024-01-15T09:30:00Z",
                    name: "name",
                    description: "description",
                    assistantIds: ["assistantIds"],
                    workflowIds: ["workflowIds"],
                    schema: { type: "string" },
                },
            ],
            metadata: {
                itemsPerPage: 1.1,
                totalItems: 1.1,
                currentPage: 1.1,
                itemsBeyondRetention: true,
                createdAtLe: "2024-01-15T09:30:00Z",
                createdAtGe: "2024-01-15T09:30:00Z",
            },
        };

        server.mockEndpoint().get("/structured-output").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

        const response = await client.structuredOutputs.structuredOutputControllerFindAll();
        expect(response).toEqual({
            results: [
                {
                    type: "ai",
                    regex: "regex",
                    model: {
                        provider: "openai",
                        model: "gpt-5.4",
                    },
                    compliancePlan: {
                        forceStoreOnHipaaEnabled: false,
                    },
                    id: "id",
                    orgId: "orgId",
                    createdAt: "2024-01-15T09:30:00Z",
                    updatedAt: "2024-01-15T09:30:00Z",
                    name: "name",
                    description: "description",
                    assistantIds: ["assistantIds"],
                    workflowIds: ["workflowIds"],
                    schema: {
                        type: "string",
                    },
                },
            ],
            metadata: {
                itemsPerPage: 1.1,
                totalItems: 1.1,
                currentPage: 1.1,
                itemsBeyondRetention: true,
                createdAtLe: "2024-01-15T09:30:00Z",
                createdAtGe: "2024-01-15T09:30:00Z",
            },
        });
    });

    test("StructuredOutputController_create", async () => {
        const server = mockServerPool.createServer();
        const client = new VapiClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
        const rawRequestBody = { name: "name", schema: { type: "string" } };
        const rawResponseBody = {
            type: "ai",
            regex: "regex",
            model: { provider: "openai", model: "gpt-5.4", temperature: 1.1, maxTokens: 1.1 },
            compliancePlan: { forceStoreOnHipaaEnabled: false },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        };

        server
            .mockEndpoint()
            .post("/structured-output")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.structuredOutputs.structuredOutputControllerCreate({
            name: "name",
            schema: {
                type: "string",
            },
        });
        expect(response).toEqual({
            type: "ai",
            regex: "regex",
            model: {
                provider: "openai",
                model: "gpt-5.4",
                temperature: 1.1,
                maxTokens: 1.1,
            },
            compliancePlan: {
                forceStoreOnHipaaEnabled: false,
            },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        });
    });

    test("StructuredOutputController_findOne", async () => {
        const server = mockServerPool.createServer();
        const client = new VapiClient({ maxRetries: 0, token: "test", environment: server.baseUrl });

        const rawResponseBody = {
            type: "ai",
            regex: "regex",
            model: { provider: "openai", model: "gpt-5.4", temperature: 1.1, maxTokens: 1.1 },
            compliancePlan: { forceStoreOnHipaaEnabled: false },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        };

        server
            .mockEndpoint()
            .get("/structured-output/id")
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.structuredOutputs.structuredOutputControllerFindOne({
            id: "id",
        });
        expect(response).toEqual({
            type: "ai",
            regex: "regex",
            model: {
                provider: "openai",
                model: "gpt-5.4",
                temperature: 1.1,
                maxTokens: 1.1,
            },
            compliancePlan: {
                forceStoreOnHipaaEnabled: false,
            },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        });
    });

    test("StructuredOutputController_remove", async () => {
        const server = mockServerPool.createServer();
        const client = new VapiClient({ maxRetries: 0, token: "test", environment: server.baseUrl });

        const rawResponseBody = {
            type: "ai",
            regex: "regex",
            model: { provider: "openai", model: "gpt-5.4", temperature: 1.1, maxTokens: 1.1 },
            compliancePlan: { forceStoreOnHipaaEnabled: false },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        };

        server
            .mockEndpoint()
            .delete("/structured-output/id")
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.structuredOutputs.structuredOutputControllerRemove({
            id: "id",
        });
        expect(response).toEqual({
            type: "ai",
            regex: "regex",
            model: {
                provider: "openai",
                model: "gpt-5.4",
                temperature: 1.1,
                maxTokens: 1.1,
            },
            compliancePlan: {
                forceStoreOnHipaaEnabled: false,
            },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        });
    });

    test("StructuredOutputController_update", async () => {
        const server = mockServerPool.createServer();
        const client = new VapiClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
        const rawRequestBody = {};
        const rawResponseBody = {
            type: "ai",
            regex: "regex",
            model: { provider: "openai", model: "gpt-5.4", temperature: 1.1, maxTokens: 1.1 },
            compliancePlan: { forceStoreOnHipaaEnabled: false },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        };

        server
            .mockEndpoint()
            .patch("/structured-output/id")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.structuredOutputs.structuredOutputControllerUpdate({
            id: "id",
            schemaOverride: "schemaOverride",
        });
        expect(response).toEqual({
            type: "ai",
            regex: "regex",
            model: {
                provider: "openai",
                model: "gpt-5.4",
                temperature: 1.1,
                maxTokens: 1.1,
            },
            compliancePlan: {
                forceStoreOnHipaaEnabled: false,
            },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        });
    });

    test("StructuredOutputController_run", async () => {
        const server = mockServerPool.createServer();
        const client = new VapiClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
        const rawRequestBody = { callIds: ["callIds"] };
        const rawResponseBody = {
            type: "ai",
            regex: "regex",
            model: { provider: "openai", model: "gpt-5.4", temperature: 1.1, maxTokens: 1.1 },
            compliancePlan: { forceStoreOnHipaaEnabled: false },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        };

        server
            .mockEndpoint()
            .post("/structured-output/run")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.structuredOutputs.structuredOutputControllerRun({
            callIds: ["callIds"],
        });
        expect(response).toEqual({
            type: "ai",
            regex: "regex",
            model: {
                provider: "openai",
                model: "gpt-5.4",
                temperature: 1.1,
                maxTokens: 1.1,
            },
            compliancePlan: {
                forceStoreOnHipaaEnabled: false,
            },
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            assistantIds: ["assistantIds"],
            workflowIds: ["workflowIds"],
            schema: {
                type: "string",
                description: "description",
                pattern: "pattern",
                format: "date-time",
                required: ["required"],
                enum: ["enum"],
                title: "title",
            },
        });
    });
});
