/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import { powerPathCourseMasteryCreateExternalPlacementTest } from "../funcs/powerPathCourseMasteryCreateExternalPlacementTest.js";
import { powerPathCourseMasteryCreateExternalTestOut } from "../funcs/powerPathCourseMasteryCreateExternalTestOut.js";
import { powerPathCourseMasteryImportExternalTestAssignmentResults } from "../funcs/powerPathCourseMasteryImportExternalTestAssignmentResults.js";
import { powerPathCourseMasteryMakeExternalTestAssignment } from "../funcs/powerPathCourseMasteryMakeExternalTestAssignment.js";
import { powerPathCourseMasteryTestOut } from "../funcs/powerPathCourseMasteryTestOut.js";
import { ClientSDK } from "../lib/sdks.js";
import { unwrapAsync } from "../types/fp.js";
export class PowerPathCourseMastery extends 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 unwrapAsync(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 unwrapAsync(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 unwrapAsync(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 unwrapAsync(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 unwrapAsync(powerPathCourseMasteryTestOut(this, request, options));
    }
}
//# sourceMappingURL=powerpathcoursemastery.js.map