/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import { powerPathCourseMasteryImportExternalTestAssignmentResults } from "../../funcs/powerPathCourseMasteryImportExternalTestAssignmentResults.js";
import * as operations from "../../models/operations/index.js";
import { formatResult } from "../tools.js";
const args = {
    request: operations.ImportExternalTestAssignmentResultsRequest$inboundSchema,
};
export const tool$powerPathCourseMasteryImportExternalTestAssignmentResults = {
    name: "power-path-course-mastery-import-external-test-assignment-results",
    description: `Import external test assignment results

Retrieves and stores the results of the external test assignment:
- Applies to both 'test-out' and 'placement' lessons.

This logic changes depending on the stored "toolProvider" of the lesson:
- For "edulastic" (currently the only one supported):

  - If the lesson is already finalized, no data import is performed.
  - If the lesson is not finalized, this will start populating the test and question results with available data, including question scores and feedback. The test will then be deemed finalized when all questions have been answered and the test grade is "GRADED".

Will fail if:
- The lesson is not an external "test-out" or "placement", or the student does not exist
- Credentials for data consumption are not available in the test result of this student (meaning a previous test assignment was not made)
- Any other problem on the Edulastic API being used that may happen

The actual test results can be retrieved by using the "getAssessmentProgress" endpoint.

A 'Lesson' in this context is a ComponentResource object which has a Resource object with lessonType = "test-out" or "placement" associated with it.
`,
    args,
    tool: async (client, args, ctx) => {
        const [result, apiCall] = await powerPathCourseMasteryImportExternalTestAssignmentResults(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=powerPathCourseMasteryImportExternalTestAssignmentResults.js.map