"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.PowerPathCourseMastery = void 0;
const powerPathCourseMasteryCreateExternalPlacementTest_js_1 = require("../funcs/powerPathCourseMasteryCreateExternalPlacementTest.js");
const powerPathCourseMasteryCreateExternalTestOut_js_1 = require("../funcs/powerPathCourseMasteryCreateExternalTestOut.js");
const powerPathCourseMasteryImportExternalTestAssignmentResults_js_1 = require("../funcs/powerPathCourseMasteryImportExternalTestAssignmentResults.js");
const powerPathCourseMasteryMakeExternalTestAssignment_js_1 = require("../funcs/powerPathCourseMasteryMakeExternalTestAssignment.js");
const powerPathCourseMasteryTestOut_js_1 = require("../funcs/powerPathCourseMasteryTestOut.js");
const sdks_js_1 = require("../lib/sdks.js");
const fp_js_1 = require("../types/fp.js");
class PowerPathCourseMastery extends sdks_js_1.ClientSDK {
    /**
     * Create an External Placement Test
     *
     * @remarks
     * Creates or updates a ComponentResource to act as a Placement Test lesson in a course.
     * This allows integrating with external test-taking platforms (like Edulastic) for content delivery.
     *
     * The endpoint creates or updates (if they already exist) the following entities:
     * - A CourseComponent for the course to hold the Placement Test lesson
     * - A Resource with lessonType = "placement" and the external service details as metadata
     * - A ComponentResource acting as the Placement Test lesson
     *
     * A test assignment is mandatory in order to obtain access credentials for this test on the external platform, as well as to obtain the IDs necessary for fetching test results later on:
     * - For test assignments, use the "makeExternalTestAssignment" endpoint.
     * - For test results retrieval, use the "importExternalTestAssignmentResults" endpoint.
     *
     * If a 'courseIdOnFail' parameter is supplied, its Course's sourcedId will be used to automatically enroll the student when the placement test is completed with a score below 90 %. When the parameter is omitted (or set to null), no automatic enrollment will happen.
     *
     * This request fails if:
     * - The 'course' provided does not exist, or a non-null 'courseIdOnFail' references a non-existent course
     * - An existing Placement Test lesson in the course, targeting the same grade, has a different toolProvider than the one provided (need to perform an update to the Resource first, altering the "toolProvider", before trying again)
     *
     * A 'Lesson' in this context is a ComponentResource object which has a Resource object with lessonType = "placement" associated with it.
     */
    async createExternalPlacementTest(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, powerPathCourseMasteryCreateExternalPlacementTest_js_1.powerPathCourseMasteryCreateExternalPlacementTest)(this, request, options));
    }
    /**
     * Create an External TestOut
     *
     * @remarks
     * Creates or updates a ComponentResource to act as a TestOut lesson in a course.
     * This allows integrating with external test-taking platforms (like Edulastic) for content delivery.
     *
     * The endpoint creates or updates (if they already exist) the following entities:
     * - A CourseComponent for the course to hold the TestOut lesson
     * - A Resource with lessonType = "test-out" and the external service details as metadata
     * - A ComponentResource acting as the TestOut lesson
     *
     * A test assignment is mandatory in order to obtain access credentials for this test on the external platform, as well as to obtain the IDs necessary for fetching test results later on:
     * - For test assignments, use the "makeExternalTestAssignment" endpoint.
     * - For test results retrieval, use the "importExternalTestAssignmentResults" endpoint.
     *
     * This request fails if:
     * - The course provided does not exist
     * - An existing TestOut lesson in the course has a different toolProvider than the one provided (need to perform an update to the Resource first, altering the "toolProvider", before trying again)
     *
     * A 'Lesson' in this context is a ComponentResource object which has a Resource object with lessonType = "test-out" associated with it.
     */
    async createExternalTestOut(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, powerPathCourseMasteryCreateExternalTestOut_js_1.powerPathCourseMasteryCreateExternalTestOut)(this, request, options));
    }
    /**
     * Import external test assignment results
     *
     * @remarks
     * 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.
     */
    async importExternalTestAssignmentResults(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, powerPathCourseMasteryImportExternalTestAssignmentResults_js_1.powerPathCourseMasteryImportExternalTestAssignmentResults)(this, request, options));
    }
    /**
     * Make external test assignment
     *
     * @remarks
     * Makes an external test assignment for the given student:
     * - Applies to both 'test-out' and 'placement' lessons.
     *
     * This logic changes depending on the provided "toolProvider" value:
     * - For "edulastic" (currently the only one supported):
     *
     *   - Authenticates the student with their email on Edulastic
     *   - Assigns the test to the student in Edulastic
     *   - Stores the received "assignmentId" and "classId" in the lesson's AssessmentResult
     *   - Returns the test link, credentials, and IDs of the test for later results consumption
     *
     * Will fail if:
     * - The lesson is not an external "test-out" or "placement", or the student does not exist
     * - External tool (described in the resource.metadata.toolProvider) is not "edulastic"
     * - Any other problem on the Edulastic API being used that may happen
     *
     * A 'Lesson' in this context is a ComponentResource object which has a Resource object with lessonType = "test-out" or "placement" associated with it.
     */
    async makeExternalTestAssignment(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, powerPathCourseMasteryMakeExternalTestAssignment_js_1.powerPathCourseMasteryMakeExternalTestAssignment)(this, request, options));
    }
    /**
     * Test out
     *
     * @remarks
     * Returns the testOut lesson reference for the given student and course.
     *
     * - TestOut is a lesson that represents the end-of-course test, covering the entire course content.
     * - The testOut should be specified by a Resource with metadata.lessonType = "test-out".
     *
     * Details:
     * - Returns a null lessonId in case no Resource with metadata.lessonType = "test-out" is found in the course.
     * - In case student has already taken the TestOut, this will return the "finalized" flag set to true.
     * - In case this is an external TestOut, also return external access credentials, if available (i.e. test was previously assigned to student).
     *
     * A 'Lesson' in this context is a ComponentResource object which has a Resource object with metadata.lessonType = "test-out" associated with it.
     */
    async testOut(request, options) {
        return (0, fp_js_1.unwrapAsync)((0, powerPathCourseMasteryTestOut_js_1.powerPathCourseMasteryTestOut)(this, request, options));
    }
}
exports.PowerPathCourseMastery = PowerPathCourseMastery;
//# sourceMappingURL=powerpathcoursemastery.js.map