import { serializeFolderReferenceV2026R0 } from './folderReferenceV2026R0.js';
import { deserializeFolderReferenceV2026R0 } from './folderReferenceV2026R0.js';
import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export class NotesConvertRequestBodyV2026R0 {
    /**
     * The content to convert to a note. See the `content_format` field for supported formats. */
    content;
    /**
     * Format of the content to convert. */
    contentFormat = 'markdown';
    parent;
    /**
     * The name for the created note. The `.boxnote` extension is appended automatically. */
    name;
    rawData;
    constructor(fields) {
        if (fields.content !== undefined) {
            this.content = fields.content;
        }
        if (fields.contentFormat !== undefined) {
            this.contentFormat = fields.contentFormat;
        }
        if (fields.parent !== undefined) {
            this.parent = fields.parent;
        }
        if (fields.name !== undefined) {
            this.name = fields.name;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
export function serializeNotesConvertRequestBodyV2026R0ContentFormatField(val) {
    return val;
}
export function deserializeNotesConvertRequestBodyV2026R0ContentFormatField(val) {
    if (val == 'markdown') {
        return val;
    }
    if (sdIsString(val)) {
        return val;
    }
    throw new BoxSdkError({
        message: "Can't deserialize NotesConvertRequestBodyV2026R0ContentFormatField",
    });
}
export function serializeNotesConvertRequestBodyV2026R0(val) {
    return {
        ['content']: val.content,
        ['content_format']: serializeNotesConvertRequestBodyV2026R0ContentFormatField(val.contentFormat),
        ['parent']: serializeFolderReferenceV2026R0(val.parent),
        ['name']: val.name,
    };
}
export function deserializeNotesConvertRequestBodyV2026R0(val) {
    if (!sdIsMap(val)) {
        throw new BoxSdkError({
            message: 'Expecting a map for "NotesConvertRequestBodyV2026R0"',
        });
    }
    if (val.content == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "content" of type "NotesConvertRequestBodyV2026R0" to be defined',
        });
    }
    if (!sdIsString(val.content)) {
        throw new BoxSdkError({
            message: 'Expecting string for "content" of type "NotesConvertRequestBodyV2026R0"',
        });
    }
    const content = val.content;
    if (val.content_format == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "content_format" of type "NotesConvertRequestBodyV2026R0" to be defined',
        });
    }
    const contentFormat = deserializeNotesConvertRequestBodyV2026R0ContentFormatField(val.content_format);
    if (val.parent == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "parent" of type "NotesConvertRequestBodyV2026R0" to be defined',
        });
    }
    const parent = deserializeFolderReferenceV2026R0(val.parent);
    if (val.name == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "name" of type "NotesConvertRequestBodyV2026R0" to be defined',
        });
    }
    if (!sdIsString(val.name)) {
        throw new BoxSdkError({
            message: 'Expecting string for "name" of type "NotesConvertRequestBodyV2026R0"',
        });
    }
    const name = val.name;
    return {
        content: content,
        contentFormat: contentFormat,
        parent: parent,
        name: name,
    };
}
export function serializeNotesConvertRequestBodyV2026R0Input(val) {
    return {
        ['content']: val.content,
        ['contentFormat']: val.contentFormat == void 0
            ? val.contentFormat
            : serializeNotesConvertRequestBodyV2026R0ContentFormatField(val.contentFormat),
        ['parent']: serializeFolderReferenceV2026R0(val.parent),
        ['name']: val.name,
    };
}
export function deserializeNotesConvertRequestBodyV2026R0Input(val) {
    if (!sdIsMap(val)) {
        throw new BoxSdkError({
            message: 'Expecting a map for "NotesConvertRequestBodyV2026R0Input"',
        });
    }
    if (val.content == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "content" of type "NotesConvertRequestBodyV2026R0Input" to be defined',
        });
    }
    if (!sdIsString(val.content)) {
        throw new BoxSdkError({
            message: 'Expecting string for "content" of type "NotesConvertRequestBodyV2026R0Input"',
        });
    }
    const content = val.content;
    const contentFormat = val.contentFormat == void 0
        ? void 0
        : deserializeNotesConvertRequestBodyV2026R0ContentFormatField(val.contentFormat);
    if (val.parent == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "parent" of type "NotesConvertRequestBodyV2026R0Input" to be defined',
        });
    }
    const parent = deserializeFolderReferenceV2026R0(val.parent);
    if (val.name == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "name" of type "NotesConvertRequestBodyV2026R0Input" to be defined',
        });
    }
    if (!sdIsString(val.name)) {
        throw new BoxSdkError({
            message: 'Expecting string for "name" of type "NotesConvertRequestBodyV2026R0Input"',
        });
    }
    const name = val.name;
    return {
        content: content,
        contentFormat: contentFormat,
        parent: parent,
        name: name,
    };
}
//# sourceMappingURL=notesConvertRequestBodyV2026R0.js.map