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

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

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

        const rawResponseBody = {
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            metrics: [{ structuredOutputId: "structuredOutputId", conditions: [{ key: "value" }] }],
            assistantIds: ["assistantIds"],
        };

        server
            .mockEndpoint()
            .get("/observability/scorecard/id")
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.observabilityScorecard.scorecardControllerGet({
            id: "id",
        });
        expect(response).toEqual({
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            metrics: [
                {
                    structuredOutputId: "structuredOutputId",
                    conditions: [
                        {
                            key: "value",
                        },
                    ],
                },
            ],
            assistantIds: ["assistantIds"],
        });
    });

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

        const rawResponseBody = {
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            metrics: [{ structuredOutputId: "structuredOutputId", conditions: [{ key: "value" }] }],
            assistantIds: ["assistantIds"],
        };

        server
            .mockEndpoint()
            .delete("/observability/scorecard/id")
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.observabilityScorecard.scorecardControllerRemove({
            id: "id",
        });
        expect(response).toEqual({
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            metrics: [
                {
                    structuredOutputId: "structuredOutputId",
                    conditions: [
                        {
                            key: "value",
                        },
                    ],
                },
            ],
            assistantIds: ["assistantIds"],
        });
    });

    test("ScorecardController_update", async () => {
        const server = mockServerPool.createServer();
        const client = new VapiClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
        const rawRequestBody = {};
        const rawResponseBody = {
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            metrics: [{ structuredOutputId: "structuredOutputId", conditions: [{ key: "value" }] }],
            assistantIds: ["assistantIds"],
        };

        server
            .mockEndpoint()
            .patch("/observability/scorecard/id")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.observabilityScorecard.scorecardControllerUpdate({
            id: "id",
        });
        expect(response).toEqual({
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            metrics: [
                {
                    structuredOutputId: "structuredOutputId",
                    conditions: [
                        {
                            key: "value",
                        },
                    ],
                },
            ],
            assistantIds: ["assistantIds"],
        });
    });

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

        const rawResponseBody = {
            results: [
                {
                    id: "id",
                    orgId: "orgId",
                    createdAt: "2024-01-15T09:30:00Z",
                    updatedAt: "2024-01-15T09:30:00Z",
                    name: "name",
                    description: "description",
                    metrics: [{ structuredOutputId: "structuredOutputId", conditions: [{ key: "value" }] }],
                    assistantIds: ["assistantIds"],
                },
            ],
            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("/observability/scorecard")
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.observabilityScorecard.scorecardControllerGetPaginated();
        expect(response).toEqual({
            results: [
                {
                    id: "id",
                    orgId: "orgId",
                    createdAt: "2024-01-15T09:30:00Z",
                    updatedAt: "2024-01-15T09:30:00Z",
                    name: "name",
                    description: "description",
                    metrics: [
                        {
                            structuredOutputId: "structuredOutputId",
                            conditions: [
                                {
                                    key: "value",
                                },
                            ],
                        },
                    ],
                    assistantIds: ["assistantIds"],
                },
            ],
            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("ScorecardController_create", async () => {
        const server = mockServerPool.createServer();
        const client = new VapiClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
        const rawRequestBody = {
            metrics: [{ structuredOutputId: "structuredOutputId", conditions: [{ key: "value" }] }],
        };
        const rawResponseBody = {
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            metrics: [{ structuredOutputId: "structuredOutputId", conditions: [{ key: "value" }] }],
            assistantIds: ["assistantIds"],
        };

        server
            .mockEndpoint()
            .post("/observability/scorecard")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.observabilityScorecard.scorecardControllerCreate({
            metrics: [
                {
                    structuredOutputId: "structuredOutputId",
                    conditions: [
                        {
                            key: "value",
                        },
                    ],
                },
            ],
        });
        expect(response).toEqual({
            id: "id",
            orgId: "orgId",
            createdAt: "2024-01-15T09:30:00Z",
            updatedAt: "2024-01-15T09:30:00Z",
            name: "name",
            description: "description",
            metrics: [
                {
                    structuredOutputId: "structuredOutputId",
                    conditions: [
                        {
                            key: "value",
                        },
                    ],
                },
            ],
            assistantIds: ["assistantIds"],
        });
    });
});
