"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotesManager = exports.CreateNoteConvertV2026R0Headers = exports.CreateNoteConvertV2026R0Optionals = void 0;
const notesConvertResponseV2026R0_1 = require("../schemas/v2026R0/notesConvertResponseV2026R0.js");
const notesConvertRequestBodyV2026R0_1 = require("../schemas/v2026R0/notesConvertRequestBodyV2026R0.js");
const notesConvertRequestBodyV2026R0_2 = require("../schemas/v2026R0/notesConvertRequestBodyV2026R0.js");
const network_1 = require("../networking/network.js");
const fetchOptions_1 = require("../networking/fetchOptions.js");
const utils_1 = require("../internal/utils.js");
const utils_2 = require("../internal/utils.js");
class CreateNoteConvertV2026R0Optionals {
    constructor(fields) {
        this.headers = new CreateNoteConvertV2026R0Headers({});
        this.cancellationToken = void 0;
        if (fields.headers !== undefined) {
            this.headers = fields.headers;
        }
        if (fields.cancellationToken !== undefined) {
            this.cancellationToken = fields.cancellationToken;
        }
    }
}
exports.CreateNoteConvertV2026R0Optionals = CreateNoteConvertV2026R0Optionals;
class CreateNoteConvertV2026R0Headers {
    constructor(fields) {
        /**
         * Version header. */
        this.boxVersion = '2026.0';
        /**
         * Extra headers that will be included in the HTTP request. */
        this.extraHeaders = {};
        if (fields.boxVersion !== undefined) {
            this.boxVersion = fields.boxVersion;
        }
        if (fields.extraHeaders !== undefined) {
            this.extraHeaders = fields.extraHeaders;
        }
    }
}
exports.CreateNoteConvertV2026R0Headers = CreateNoteConvertV2026R0Headers;
class NotesManager {
    constructor(fields) {
        this.networkSession = new network_1.NetworkSession({});
        if (fields.auth !== undefined) {
            this.auth = fields.auth;
        }
        if (fields.networkSession !== undefined) {
            this.networkSession = fields.networkSession;
        }
    }
    /**
     * Creates a Box Note (`.boxnote` file) from supported source content. See the `content_format` field for supported formats.
     * @param {NotesConvertRequestBodyV2026R0Input} requestBodyInput Request body of createNoteConvertV2026R0 method
     * @param {CreateNoteConvertV2026R0OptionalsInput} optionalsInput
     * @returns {Promise<NotesConvertResponseV2026R0>}
     */
    createNoteConvertV2026R0(requestBodyInput_1) {
        return __awaiter(this, arguments, void 0, function* (requestBodyInput, optionalsInput = {}) {
            const requestBody = new notesConvertRequestBodyV2026R0_2.NotesConvertRequestBodyV2026R0({
                content: requestBodyInput.content,
                contentFormat: requestBodyInput.contentFormat,
                parent: requestBodyInput.parent,
                name: requestBodyInput.name,
            });
            const optionals = new CreateNoteConvertV2026R0Optionals({
                headers: optionalsInput.headers,
                cancellationToken: optionalsInput.cancellationToken,
            });
            const headers = optionals.headers;
            const cancellationToken = optionals.cancellationToken;
            const headersMap = (0, utils_1.prepareParams)(Object.assign({ ['box-version']: (0, utils_2.toString)(headers.boxVersion) }, headers.extraHeaders));
            const response = yield this.networkSession.networkClient.fetch(new fetchOptions_1.FetchOptions({
                url: ''.concat(this.networkSession.baseUrls.baseUrl, '/2.0/notes/convert'),
                method: 'POST',
                headers: headersMap,
                data: (0, notesConvertRequestBodyV2026R0_1.serializeNotesConvertRequestBodyV2026R0)(requestBody),
                contentType: 'application/json',
                responseFormat: 'json',
                auth: this.auth,
                networkSession: this.networkSession,
                cancellationToken: cancellationToken,
            }));
            return Object.assign(Object.assign({}, (0, notesConvertResponseV2026R0_1.deserializeNotesConvertResponseV2026R0)(response.data)), { rawData: response.data });
        });
    }
}
exports.NotesManager = NotesManager;
//# sourceMappingURL=notes.js.map