"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.QuestionType$ = exports.QuestionType$outboundSchema = exports.QuestionType$inboundSchema = exports.QuestionValue$ = exports.QuestionValue$outboundSchema = exports.QuestionValue$inboundSchema = exports.questionSourceValueFromJSON = exports.questionSourceValueToJSON = exports.QuestionSourceValue$ = exports.QuestionSourceValue$outboundSchema = exports.QuestionSourceValue$inboundSchema = exports.question4FromJSON = exports.question4ToJSON = exports.Question4$ = exports.Question4$outboundSchema = exports.Question4$inboundSchema = exports.questionRequiredFromJSON = exports.questionRequiredToJSON = exports.QuestionRequired$ = exports.QuestionRequired$outboundSchema = exports.QuestionRequired$inboundSchema = exports.Question2$ = exports.Question2$outboundSchema = exports.Question2$inboundSchema = exports.parentQuestionFromJSON = exports.parentQuestionToJSON = exports.ParentQuestion$ = exports.ParentQuestion$outboundSchema = exports.ParentQuestion$inboundSchema = exports.conditionTypeFromJSON = exports.conditionTypeToJSON = exports.ConditionType$ = exports.ConditionType$outboundSchema = exports.ConditionType$inboundSchema = exports.QuestionSchemasValue$ = exports.QuestionSchemasValue$outboundSchema = exports.QuestionSchemasValue$inboundSchema = exports.questionSchemasSourceValueFromJSON = exports.questionSchemasSourceValueToJSON = exports.QuestionSchemasSourceValue$ = exports.QuestionSchemasSourceValue$outboundSchema = exports.QuestionSchemasSourceValue$inboundSchema = exports.questionSchemas4FromJSON = exports.questionSchemas4ToJSON = exports.QuestionSchemas4$ = exports.QuestionSchemas4$outboundSchema = exports.QuestionSchemas4$inboundSchema = exports.QuestionValue = exports.Question2 = exports.QuestionSchemasValue = void 0;
exports.questionFromJSON = exports.questionToJSON = exports.Question$ = exports.Question$outboundSchema = exports.Question$inboundSchema = exports.questionTypeFromJSON = exports.questionTypeToJSON = 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 questionmultiplechoiceanswers_js_1 = require("./questionmultiplechoiceanswers.js");
/**
 * The type of the question's condition
 */
var QuestionSchemasValue;
(function (QuestionSchemasValue) {
    QuestionSchemasValue["EqualsTo"] = "equals_to";
    QuestionSchemasValue["Contains"] = "contains";
})(QuestionSchemasValue || (exports.QuestionSchemasValue = QuestionSchemasValue = {}));
var Question2;
(function (Question2) {
    Question2["True"] = "true";
    Question2["False"] = "false";
})(Question2 || (exports.Question2 = Question2 = {}));
/**
 * The type of the questions.
 */
var QuestionValue;
(function (QuestionValue) {
    QuestionValue["ShortText"] = "short_text";
    QuestionValue["LongText"] = "long_text";
    QuestionValue["Attachment"] = "attachment";
    QuestionValue["MultiSelect"] = "multi_select";
    QuestionValue["SingleSelect"] = "single_select";
    QuestionValue["Boolean"] = "boolean";
    QuestionValue["Number"] = "number";
    QuestionValue["Date"] = "date";
    QuestionValue["Video"] = "video";
})(QuestionValue || (exports.QuestionValue = QuestionValue = {}));
/** @internal */
exports.QuestionSchemas4$inboundSchema = z.object({});
/** @internal */
exports.QuestionSchemas4$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 QuestionSchemas4$;
(function (QuestionSchemas4$) {
    /** @deprecated use `QuestionSchemas4$inboundSchema` instead. */
    QuestionSchemas4$.inboundSchema = exports.QuestionSchemas4$inboundSchema;
    /** @deprecated use `QuestionSchemas4$outboundSchema` instead. */
    QuestionSchemas4$.outboundSchema = exports.QuestionSchemas4$outboundSchema;
})(QuestionSchemas4$ || (exports.QuestionSchemas4$ = QuestionSchemas4$ = {}));
function questionSchemas4ToJSON(questionSchemas4) {
    return JSON.stringify(exports.QuestionSchemas4$outboundSchema.parse(questionSchemas4));
}
exports.questionSchemas4ToJSON = questionSchemas4ToJSON;
function questionSchemas4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.QuestionSchemas4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'QuestionSchemas4' from JSON`);
}
exports.questionSchemas4FromJSON = questionSchemas4FromJSON;
/** @internal */
exports.QuestionSchemasSourceValue$inboundSchema = z.union([
    z.lazy(() => exports.QuestionSchemas4$inboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/** @internal */
exports.QuestionSchemasSourceValue$outboundSchema = z.union([
    z.lazy(() => exports.QuestionSchemas4$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 QuestionSchemasSourceValue$;
(function (QuestionSchemasSourceValue$) {
    /** @deprecated use `QuestionSchemasSourceValue$inboundSchema` instead. */
    QuestionSchemasSourceValue$.inboundSchema = exports.QuestionSchemasSourceValue$inboundSchema;
    /** @deprecated use `QuestionSchemasSourceValue$outboundSchema` instead. */
    QuestionSchemasSourceValue$.outboundSchema = exports.QuestionSchemasSourceValue$outboundSchema;
})(QuestionSchemasSourceValue$ || (exports.QuestionSchemasSourceValue$ = QuestionSchemasSourceValue$ = {}));
function questionSchemasSourceValueToJSON(questionSchemasSourceValue) {
    return JSON.stringify(exports.QuestionSchemasSourceValue$outboundSchema.parse(questionSchemasSourceValue));
}
exports.questionSchemasSourceValueToJSON = questionSchemasSourceValueToJSON;
function questionSchemasSourceValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.QuestionSchemasSourceValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'QuestionSchemasSourceValue' from JSON`);
}
exports.questionSchemasSourceValueFromJSON = questionSchemasSourceValueFromJSON;
/** @internal */
exports.QuestionSchemasValue$inboundSchema = z
    .union([
    z.nativeEnum(QuestionSchemasValue),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.QuestionSchemasValue$outboundSchema = z.union([
    z.nativeEnum(QuestionSchemasValue),
    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 QuestionSchemasValue$;
(function (QuestionSchemasValue$) {
    /** @deprecated use `QuestionSchemasValue$inboundSchema` instead. */
    QuestionSchemasValue$.inboundSchema = exports.QuestionSchemasValue$inboundSchema;
    /** @deprecated use `QuestionSchemasValue$outboundSchema` instead. */
    QuestionSchemasValue$.outboundSchema = exports.QuestionSchemasValue$outboundSchema;
})(QuestionSchemasValue$ || (exports.QuestionSchemasValue$ = QuestionSchemasValue$ = {}));
/** @internal */
exports.ConditionType$inboundSchema = z.object({
    source_value: z.nullable(z.union([
        z.lazy(() => exports.QuestionSchemas4$inboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.QuestionSchemasValue$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "source_value": "sourceValue",
    });
});
/** @internal */
exports.ConditionType$outboundSchema = z.object({
    sourceValue: z.nullable(z.union([
        z.lazy(() => exports.QuestionSchemas4$outboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.QuestionSchemasValue$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 ConditionType$;
(function (ConditionType$) {
    /** @deprecated use `ConditionType$inboundSchema` instead. */
    ConditionType$.inboundSchema = exports.ConditionType$inboundSchema;
    /** @deprecated use `ConditionType$outboundSchema` instead. */
    ConditionType$.outboundSchema = exports.ConditionType$outboundSchema;
})(ConditionType$ || (exports.ConditionType$ = ConditionType$ = {}));
function conditionTypeToJSON(conditionType) {
    return JSON.stringify(exports.ConditionType$outboundSchema.parse(conditionType));
}
exports.conditionTypeToJSON = conditionTypeToJSON;
function conditionTypeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ConditionType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConditionType' from JSON`);
}
exports.conditionTypeFromJSON = conditionTypeFromJSON;
/** @internal */
exports.ParentQuestion$inboundSchema = z.object({
    condition_type: z.nullable(z.lazy(() => exports.ConditionType$inboundSchema))
        .optional(),
    id: z.nullable(z.string()).optional(),
    option_ids: z.nullable(z.array(z.string())).optional(),
    remote_id: z.nullable(z.string()).optional(),
    remote_option_ids: z.nullable(z.array(z.string())).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "condition_type": "conditionType",
        "option_ids": "optionIds",
        "remote_id": "remoteId",
        "remote_option_ids": "remoteOptionIds",
    });
});
/** @internal */
exports.ParentQuestion$outboundSchema = z.object({
    conditionType: z.nullable(z.lazy(() => exports.ConditionType$outboundSchema))
        .optional(),
    id: z.nullable(z.string()).optional(),
    optionIds: z.nullable(z.array(z.string())).optional(),
    remoteId: z.nullable(z.string()).optional(),
    remoteOptionIds: z.nullable(z.array(z.string())).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        conditionType: "condition_type",
        optionIds: "option_ids",
        remoteId: "remote_id",
        remoteOptionIds: "remote_option_ids",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var ParentQuestion$;
(function (ParentQuestion$) {
    /** @deprecated use `ParentQuestion$inboundSchema` instead. */
    ParentQuestion$.inboundSchema = exports.ParentQuestion$inboundSchema;
    /** @deprecated use `ParentQuestion$outboundSchema` instead. */
    ParentQuestion$.outboundSchema = exports.ParentQuestion$outboundSchema;
})(ParentQuestion$ || (exports.ParentQuestion$ = ParentQuestion$ = {}));
function parentQuestionToJSON(parentQuestion) {
    return JSON.stringify(exports.ParentQuestion$outboundSchema.parse(parentQuestion));
}
exports.parentQuestionToJSON = parentQuestionToJSON;
function parentQuestionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ParentQuestion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ParentQuestion' from JSON`);
}
exports.parentQuestionFromJSON = parentQuestionFromJSON;
/** @internal */
exports.Question2$inboundSchema = z
    .nativeEnum(Question2);
/** @internal */
exports.Question2$outboundSchema = exports.Question2$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Question2$;
(function (Question2$) {
    /** @deprecated use `Question2$inboundSchema` instead. */
    Question2$.inboundSchema = exports.Question2$inboundSchema;
    /** @deprecated use `Question2$outboundSchema` instead. */
    Question2$.outboundSchema = exports.Question2$outboundSchema;
})(Question2$ || (exports.Question2$ = Question2$ = {}));
/** @internal */
exports.QuestionRequired$inboundSchema = z.union([z.boolean(), exports.Question2$inboundSchema]);
/** @internal */
exports.QuestionRequired$outboundSchema = z.union([z.boolean(), exports.Question2$outboundSchema]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var QuestionRequired$;
(function (QuestionRequired$) {
    /** @deprecated use `QuestionRequired$inboundSchema` instead. */
    QuestionRequired$.inboundSchema = exports.QuestionRequired$inboundSchema;
    /** @deprecated use `QuestionRequired$outboundSchema` instead. */
    QuestionRequired$.outboundSchema = exports.QuestionRequired$outboundSchema;
})(QuestionRequired$ || (exports.QuestionRequired$ = QuestionRequired$ = {}));
function questionRequiredToJSON(questionRequired) {
    return JSON.stringify(exports.QuestionRequired$outboundSchema.parse(questionRequired));
}
exports.questionRequiredToJSON = questionRequiredToJSON;
function questionRequiredFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.QuestionRequired$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'QuestionRequired' from JSON`);
}
exports.questionRequiredFromJSON = questionRequiredFromJSON;
/** @internal */
exports.Question4$inboundSchema = z.object({});
/** @internal */
exports.Question4$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 Question4$;
(function (Question4$) {
    /** @deprecated use `Question4$inboundSchema` instead. */
    Question4$.inboundSchema = exports.Question4$inboundSchema;
    /** @deprecated use `Question4$outboundSchema` instead. */
    Question4$.outboundSchema = exports.Question4$outboundSchema;
})(Question4$ || (exports.Question4$ = Question4$ = {}));
function question4ToJSON(question4) {
    return JSON.stringify(exports.Question4$outboundSchema.parse(question4));
}
exports.question4ToJSON = question4ToJSON;
function question4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Question4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Question4' from JSON`);
}
exports.question4FromJSON = question4FromJSON;
/** @internal */
exports.QuestionSourceValue$inboundSchema = z.union([
    z.lazy(() => exports.Question4$inboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/** @internal */
exports.QuestionSourceValue$outboundSchema = z.union([
    z.lazy(() => exports.Question4$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 QuestionSourceValue$;
(function (QuestionSourceValue$) {
    /** @deprecated use `QuestionSourceValue$inboundSchema` instead. */
    QuestionSourceValue$.inboundSchema = exports.QuestionSourceValue$inboundSchema;
    /** @deprecated use `QuestionSourceValue$outboundSchema` instead. */
    QuestionSourceValue$.outboundSchema = exports.QuestionSourceValue$outboundSchema;
})(QuestionSourceValue$ || (exports.QuestionSourceValue$ = QuestionSourceValue$ = {}));
function questionSourceValueToJSON(questionSourceValue) {
    return JSON.stringify(exports.QuestionSourceValue$outboundSchema.parse(questionSourceValue));
}
exports.questionSourceValueToJSON = questionSourceValueToJSON;
function questionSourceValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.QuestionSourceValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'QuestionSourceValue' from JSON`);
}
exports.questionSourceValueFromJSON = questionSourceValueFromJSON;
/** @internal */
exports.QuestionValue$inboundSchema = z
    .union([
    z.nativeEnum(QuestionValue),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.QuestionValue$outboundSchema = z.union([
    z.nativeEnum(QuestionValue),
    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 QuestionValue$;
(function (QuestionValue$) {
    /** @deprecated use `QuestionValue$inboundSchema` instead. */
    QuestionValue$.inboundSchema = exports.QuestionValue$inboundSchema;
    /** @deprecated use `QuestionValue$outboundSchema` instead. */
    QuestionValue$.outboundSchema = exports.QuestionValue$outboundSchema;
})(QuestionValue$ || (exports.QuestionValue$ = QuestionValue$ = {}));
/** @internal */
exports.QuestionType$inboundSchema = z.object({
    source_value: z.nullable(z.union([
        z.lazy(() => exports.Question4$inboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.QuestionValue$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "source_value": "sourceValue",
    });
});
/** @internal */
exports.QuestionType$outboundSchema = z.object({
    sourceValue: z.nullable(z.union([
        z.lazy(() => exports.Question4$outboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.QuestionValue$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 QuestionType$;
(function (QuestionType$) {
    /** @deprecated use `QuestionType$inboundSchema` instead. */
    QuestionType$.inboundSchema = exports.QuestionType$inboundSchema;
    /** @deprecated use `QuestionType$outboundSchema` instead. */
    QuestionType$.outboundSchema = exports.QuestionType$outboundSchema;
})(QuestionType$ || (exports.QuestionType$ = QuestionType$ = {}));
function questionTypeToJSON(questionType) {
    return JSON.stringify(exports.QuestionType$outboundSchema.parse(questionType));
}
exports.questionTypeToJSON = questionTypeToJSON;
function questionTypeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.QuestionType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'QuestionType' from JSON`);
}
exports.questionTypeFromJSON = questionTypeFromJSON;
/** @internal */
exports.Question$inboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    multiple_choice_answers: z.nullable(z.array(questionmultiplechoiceanswers_js_1.QuestionMultipleChoiceAnswers$inboundSchema)).optional(),
    name: z.nullable(z.string()).optional(),
    parent_question: z.nullable(z.lazy(() => exports.ParentQuestion$inboundSchema))
        .optional(),
    remote_id: z.nullable(z.string()).optional(),
    required: z.nullable(z.union([z.boolean(), exports.Question2$inboundSchema]))
        .optional(),
    text: z.nullable(z.string()).optional(),
    type: z.nullable(z.lazy(() => exports.QuestionType$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "multiple_choice_answers": "multipleChoiceAnswers",
        "parent_question": "parentQuestion",
        "remote_id": "remoteId",
    });
});
/** @internal */
exports.Question$outboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    multipleChoiceAnswers: z.nullable(z.array(questionmultiplechoiceanswers_js_1.QuestionMultipleChoiceAnswers$outboundSchema)).optional(),
    name: z.nullable(z.string()).optional(),
    parentQuestion: z.nullable(z.lazy(() => exports.ParentQuestion$outboundSchema))
        .optional(),
    remoteId: z.nullable(z.string()).optional(),
    required: z.nullable(z.union([z.boolean(), exports.Question2$outboundSchema]))
        .optional(),
    text: z.nullable(z.string()).optional(),
    type: z.nullable(z.lazy(() => exports.QuestionType$outboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        multipleChoiceAnswers: "multiple_choice_answers",
        parentQuestion: "parent_question",
        remoteId: "remote_id",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Question$;
(function (Question$) {
    /** @deprecated use `Question$inboundSchema` instead. */
    Question$.inboundSchema = exports.Question$inboundSchema;
    /** @deprecated use `Question$outboundSchema` instead. */
    Question$.outboundSchema = exports.Question$outboundSchema;
})(Question$ || (exports.Question$ = Question$ = {}));
function questionToJSON(question) {
    return JSON.stringify(exports.Question$outboundSchema.parse(question));
}
exports.questionToJSON = questionToJSON;
function questionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Question$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Question' from JSON`);
}
exports.questionFromJSON = questionFromJSON;
//# sourceMappingURL=question.js.map