import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export class FolderReferenceV2026R0 {
    /**
     * The value will always be `folder`. */
    type = 'folder';
    /**
     * ID of the folder. */
    id;
    rawData;
    constructor(fields) {
        if (fields.type !== undefined) {
            this.type = fields.type;
        }
        if (fields.id !== undefined) {
            this.id = fields.id;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
export function serializeFolderReferenceV2026R0TypeField(val) {
    return val;
}
export function deserializeFolderReferenceV2026R0TypeField(val) {
    if (val == 'folder') {
        return val;
    }
    throw new BoxSdkError({
        message: "Can't deserialize FolderReferenceV2026R0TypeField",
    });
}
export function serializeFolderReferenceV2026R0(val) {
    return {
        ['type']: serializeFolderReferenceV2026R0TypeField(val.type),
        ['id']: val.id,
    };
}
export function deserializeFolderReferenceV2026R0(val) {
    if (!sdIsMap(val)) {
        throw new BoxSdkError({
            message: 'Expecting a map for "FolderReferenceV2026R0"',
        });
    }
    if (val.type == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "type" of type "FolderReferenceV2026R0" to be defined',
        });
    }
    const type = deserializeFolderReferenceV2026R0TypeField(val.type);
    if (val.id == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "id" of type "FolderReferenceV2026R0" to be defined',
        });
    }
    if (!sdIsString(val.id)) {
        throw new BoxSdkError({
            message: 'Expecting string for "id" of type "FolderReferenceV2026R0"',
        });
    }
    const id = val.id;
    return { type: type, id: id };
}
export function serializeFolderReferenceV2026R0Input(val) {
    return {
        ['type']: val.type == void 0
            ? val.type
            : serializeFolderReferenceV2026R0TypeField(val.type),
        ['id']: val.id,
    };
}
export function deserializeFolderReferenceV2026R0Input(val) {
    if (!sdIsMap(val)) {
        throw new BoxSdkError({
            message: 'Expecting a map for "FolderReferenceV2026R0Input"',
        });
    }
    const type = val.type == void 0
        ? void 0
        : deserializeFolderReferenceV2026R0TypeField(val.type);
    if (val.id == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "id" of type "FolderReferenceV2026R0Input" to be defined',
        });
    }
    if (!sdIsString(val.id)) {
        throw new BoxSdkError({
            message: 'Expecting string for "id" of type "FolderReferenceV2026R0Input"',
        });
    }
    const id = val.id;
    return { type: type, id: id };
}
//# sourceMappingURL=folderReferenceV2026R0.js.map