/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
export const EnrollmentStatus = {
    Active: "active",
    Tobedeleted: "tobedeleted",
};
export const EnrollmentRole = {
    Administrator: "administrator",
    Proctor: "proctor",
    Student: "student",
    Teacher: "teacher",
};
/** @internal */
export const EnrollmentStatus$inboundSchema = z.nativeEnum(EnrollmentStatus);
/** @internal */
export const EnrollmentStatus$outboundSchema = EnrollmentStatus$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var EnrollmentStatus$;
(function (EnrollmentStatus$) {
    /** @deprecated use `EnrollmentStatus$inboundSchema` instead. */
    EnrollmentStatus$.inboundSchema = EnrollmentStatus$inboundSchema;
    /** @deprecated use `EnrollmentStatus$outboundSchema` instead. */
    EnrollmentStatus$.outboundSchema = EnrollmentStatus$outboundSchema;
})(EnrollmentStatus$ || (EnrollmentStatus$ = {}));
/** @internal */
export const EnrollmentRole$inboundSchema = z.nativeEnum(EnrollmentRole);
/** @internal */
export const EnrollmentRole$outboundSchema = EnrollmentRole$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var EnrollmentRole$;
(function (EnrollmentRole$) {
    /** @deprecated use `EnrollmentRole$inboundSchema` instead. */
    EnrollmentRole$.inboundSchema = EnrollmentRole$inboundSchema;
    /** @deprecated use `EnrollmentRole$outboundSchema` instead. */
    EnrollmentRole$.outboundSchema = EnrollmentRole$outboundSchema;
})(EnrollmentRole$ || (EnrollmentRole$ = {}));
/** @internal */
export const User$inboundSchema = z
    .object({
    href: z.string(),
    sourcedId: z.string(),
    type: z.string(),
});
/** @internal */
export const User$outboundSchema = z.object({
    href: z.string(),
    sourcedId: z.string(),
    type: z.string(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var User$;
(function (User$) {
    /** @deprecated use `User$inboundSchema` instead. */
    User$.inboundSchema = User$inboundSchema;
    /** @deprecated use `User$outboundSchema` instead. */
    User$.outboundSchema = User$outboundSchema;
})(User$ || (User$ = {}));
export function userToJSON(user) {
    return JSON.stringify(User$outboundSchema.parse(user));
}
export function userFromJSON(jsonString) {
    return safeParse(jsonString, (x) => User$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'User' from JSON`);
}
/** @internal */
export const EnrollmentClass$inboundSchema = z.object({
    href: z.string(),
    sourcedId: z.string(),
    type: z.string(),
});
/** @internal */
export const EnrollmentClass$outboundSchema = z.object({
    href: z.string(),
    sourcedId: z.string(),
    type: z.string(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var EnrollmentClass$;
(function (EnrollmentClass$) {
    /** @deprecated use `EnrollmentClass$inboundSchema` instead. */
    EnrollmentClass$.inboundSchema = EnrollmentClass$inboundSchema;
    /** @deprecated use `EnrollmentClass$outboundSchema` instead. */
    EnrollmentClass$.outboundSchema = EnrollmentClass$outboundSchema;
})(EnrollmentClass$ || (EnrollmentClass$ = {}));
export function enrollmentClassToJSON(enrollmentClass) {
    return JSON.stringify(EnrollmentClass$outboundSchema.parse(enrollmentClass));
}
export function enrollmentClassFromJSON(jsonString) {
    return safeParse(jsonString, (x) => EnrollmentClass$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EnrollmentClass' from JSON`);
}
/** @internal */
export const Enrollment$inboundSchema = z.object({
    sourcedId: z.string(),
    status: EnrollmentStatus$inboundSchema,
    dateLastModified: z.string().datetime({ offset: true }).transform(v => new Date(v)).optional(),
    metadata: z.nullable(z.record(z.any())).optional(),
    role: EnrollmentRole$inboundSchema,
    primary: z.boolean(),
    beginDate: z.nullable(z.string()),
    endDate: z.nullable(z.string()),
    user: z.lazy(() => User$inboundSchema),
    class: z.lazy(() => EnrollmentClass$inboundSchema),
});
/** @internal */
export const Enrollment$outboundSchema = z.object({
    sourcedId: z.string(),
    status: EnrollmentStatus$outboundSchema,
    dateLastModified: z.date().transform(v => v.toISOString()).optional(),
    metadata: z.nullable(z.record(z.any())).optional(),
    role: EnrollmentRole$outboundSchema,
    primary: z.boolean(),
    beginDate: z.nullable(z.string()),
    endDate: z.nullable(z.string()),
    user: z.lazy(() => User$outboundSchema),
    class: z.lazy(() => EnrollmentClass$outboundSchema),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Enrollment$;
(function (Enrollment$) {
    /** @deprecated use `Enrollment$inboundSchema` instead. */
    Enrollment$.inboundSchema = Enrollment$inboundSchema;
    /** @deprecated use `Enrollment$outboundSchema` instead. */
    Enrollment$.outboundSchema = Enrollment$outboundSchema;
})(Enrollment$ || (Enrollment$ = {}));
export function enrollmentToJSON(enrollment) {
    return JSON.stringify(Enrollment$outboundSchema.parse(enrollment));
}
export function enrollmentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Enrollment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Enrollment' from JSON`);
}
//# sourceMappingURL=enrollment.js.map