"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.noteFromJSON = exports.noteToJSON = exports.Note$ = exports.Note$outboundSchema = exports.Note$inboundSchema = exports.noteVisibilityFromJSON = exports.noteVisibilityToJSON = exports.NoteVisibility$ = exports.NoteVisibility$outboundSchema = exports.NoteVisibility$inboundSchema = exports.NoteValue$ = exports.NoteValue$outboundSchema = exports.NoteValue$inboundSchema = exports.noteSourceValueFromJSON = exports.noteSourceValueToJSON = exports.NoteSourceValue$ = exports.NoteSourceValue$outboundSchema = exports.NoteSourceValue$inboundSchema = exports.note4FromJSON = exports.note4ToJSON = exports.Note4$ = exports.Note4$outboundSchema = exports.Note4$inboundSchema = exports.NoteValue = void 0;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../../lib/primitives.js");
const schemas_js_1 = require("../../../lib/schemas.js");
const enums_js_1 = require("../../types/enums.js");
const notecontentapimodel_js_1 = require("./notecontentapimodel.js");
/**
 * The visibility of the notes.
 */
var NoteValue;
(function (NoteValue) {
    NoteValue["Private"] = "private";
    NoteValue["Public"] = "public";
    NoteValue["UnmappedValue"] = "unmapped_value";
})(NoteValue || (exports.NoteValue = NoteValue = {}));
/** @internal */
exports.Note4$inboundSchema = z
    .object({});
/** @internal */
exports.Note4$outboundSchema = z.object({});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Note4$;
(function (Note4$) {
    /** @deprecated use `Note4$inboundSchema` instead. */
    Note4$.inboundSchema = exports.Note4$inboundSchema;
    /** @deprecated use `Note4$outboundSchema` instead. */
    Note4$.outboundSchema = exports.Note4$outboundSchema;
})(Note4$ || (exports.Note4$ = Note4$ = {}));
function note4ToJSON(note4) {
    return JSON.stringify(exports.Note4$outboundSchema.parse(note4));
}
exports.note4ToJSON = note4ToJSON;
function note4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Note4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Note4' from JSON`);
}
exports.note4FromJSON = note4FromJSON;
/** @internal */
exports.NoteSourceValue$inboundSchema = z.union([
    z.lazy(() => exports.Note4$inboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/** @internal */
exports.NoteSourceValue$outboundSchema = z.union([
    z.lazy(() => exports.Note4$outboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var NoteSourceValue$;
(function (NoteSourceValue$) {
    /** @deprecated use `NoteSourceValue$inboundSchema` instead. */
    NoteSourceValue$.inboundSchema = exports.NoteSourceValue$inboundSchema;
    /** @deprecated use `NoteSourceValue$outboundSchema` instead. */
    NoteSourceValue$.outboundSchema = exports.NoteSourceValue$outboundSchema;
})(NoteSourceValue$ || (exports.NoteSourceValue$ = NoteSourceValue$ = {}));
function noteSourceValueToJSON(noteSourceValue) {
    return JSON.stringify(exports.NoteSourceValue$outboundSchema.parse(noteSourceValue));
}
exports.noteSourceValueToJSON = noteSourceValueToJSON;
function noteSourceValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.NoteSourceValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NoteSourceValue' from JSON`);
}
exports.noteSourceValueFromJSON = noteSourceValueFromJSON;
/** @internal */
exports.NoteValue$inboundSchema = z
    .union([
    z.nativeEnum(NoteValue),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.NoteValue$outboundSchema = z.union([
    z.nativeEnum(NoteValue),
    z.string().and(z.custom()),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var NoteValue$;
(function (NoteValue$) {
    /** @deprecated use `NoteValue$inboundSchema` instead. */
    NoteValue$.inboundSchema = exports.NoteValue$inboundSchema;
    /** @deprecated use `NoteValue$outboundSchema` instead. */
    NoteValue$.outboundSchema = exports.NoteValue$outboundSchema;
})(NoteValue$ || (exports.NoteValue$ = NoteValue$ = {}));
/** @internal */
exports.NoteVisibility$inboundSchema = z.object({
    source_value: z.nullable(z.union([
        z.lazy(() => exports.Note4$inboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.NoteValue$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "source_value": "sourceValue",
    });
});
/** @internal */
exports.NoteVisibility$outboundSchema = z.object({
    sourceValue: z.nullable(z.union([
        z.lazy(() => exports.Note4$outboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.NoteValue$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        sourceValue: "source_value",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var NoteVisibility$;
(function (NoteVisibility$) {
    /** @deprecated use `NoteVisibility$inboundSchema` instead. */
    NoteVisibility$.inboundSchema = exports.NoteVisibility$inboundSchema;
    /** @deprecated use `NoteVisibility$outboundSchema` instead. */
    NoteVisibility$.outboundSchema = exports.NoteVisibility$outboundSchema;
})(NoteVisibility$ || (exports.NoteVisibility$ = NoteVisibility$ = {}));
function noteVisibilityToJSON(noteVisibility) {
    return JSON.stringify(exports.NoteVisibility$outboundSchema.parse(noteVisibility));
}
exports.noteVisibilityToJSON = noteVisibilityToJSON;
function noteVisibilityFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.NoteVisibility$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NoteVisibility' from JSON`);
}
exports.noteVisibilityFromJSON = noteVisibilityFromJSON;
/** @internal */
exports.Note$inboundSchema = z
    .object({
    author_id: z.nullable(z.string()).optional(),
    content: z.nullable(z.array(notecontentapimodel_js_1.NoteContentApiModel$inboundSchema)).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    deleted_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    id: z.nullable(z.string()).optional(),
    remote_author_id: z.nullable(z.string()).optional(),
    remote_id: z.nullable(z.string()).optional(),
    unified_custom_fields: z.nullable(z.record(z.any())).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    visibility: z.nullable(z.lazy(() => exports.NoteVisibility$inboundSchema))
        .optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "author_id": "authorId",
        "created_at": "createdAt",
        "deleted_at": "deletedAt",
        "remote_author_id": "remoteAuthorId",
        "remote_id": "remoteId",
        "unified_custom_fields": "unifiedCustomFields",
        "updated_at": "updatedAt",
    });
});
/** @internal */
exports.Note$outboundSchema = z.object({
    authorId: z.nullable(z.string()).optional(),
    content: z.nullable(z.array(notecontentapimodel_js_1.NoteContentApiModel$outboundSchema)).optional(),
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    deletedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    id: z.nullable(z.string()).optional(),
    remoteAuthorId: z.nullable(z.string()).optional(),
    remoteId: z.nullable(z.string()).optional(),
    unifiedCustomFields: z.nullable(z.record(z.any())).optional(),
    updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    visibility: z.nullable(z.lazy(() => exports.NoteVisibility$outboundSchema))
        .optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        authorId: "author_id",
        createdAt: "created_at",
        deletedAt: "deleted_at",
        remoteAuthorId: "remote_author_id",
        remoteId: "remote_id",
        unifiedCustomFields: "unified_custom_fields",
        updatedAt: "updated_at",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Note$;
(function (Note$) {
    /** @deprecated use `Note$inboundSchema` instead. */
    Note$.inboundSchema = exports.Note$inboundSchema;
    /** @deprecated use `Note$outboundSchema` instead. */
    Note$.outboundSchema = exports.Note$outboundSchema;
})(Note$ || (exports.Note$ = Note$ = {}));
function noteToJSON(note) {
    return JSON.stringify(exports.Note$outboundSchema.parse(note));
}
exports.noteToJSON = noteToJSON;
function noteFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Note$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Note' from JSON`);
}
exports.noteFromJSON = noteFromJSON;
//# sourceMappingURL=note.js.map