/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import { lessonsFinalizeResponse } from "../../funcs/lessonsFinalizeResponse.js";
import * as operations from "../../models/operations/index.js";
import { formatResult } from "../tools.js";
const args = {
    request: operations.FinalStudentAssessmentResponseRequest$inboundSchema
        .optional(),
};
export const tool$lessonsFinalizeResponse = {
    name: "lessons-finalize-response",
    description: `Finalize a test assessments

Finalize a lesson of type \`quiz\`, \`test-out\`, or \`placement\` after all questions have been answered:
- Evaluates answered questions, attribute scores for each question, and overall lesson score.
- Checks the correctness of the response using the QTI question's \`<qti-response-declaration>\` element and update the score accordingly.
- Creates/updates the AssessmentLineItem and AssessmentResult objects for the student/question pair if it doesn't exist yet.

Not supported for external test lessons as the 3rd party tool is responsible for finalizing the test. Use the **importExternalTestAssignmentResults** endpoint instead.

A 'Lesson' in this context is a ComponentResource object which has a Resource object with metadata.lessonType = "quiz", "test-out", or "placement" associated with it.
`,
    args,
    tool: async (client, args, ctx) => {
        const [result, apiCall] = await lessonsFinalizeResponse(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
        if (!result.ok) {
            return {
                content: [{ type: "text", text: result.error.message }],
                isError: true,
            };
        }
        const value = result.value;
        return formatResult(value, apiCall);
    },
};
//# sourceMappingURL=lessonsFinalizeResponse.js.map