/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
export const OrgStatus = {
    Active: "active",
    Tobedeleted: "tobedeleted",
};
export const OrgType1 = {
    Department: "department",
    School: "school",
    District: "district",
    Local: "local",
    State: "state",
    National: "national",
};
/** @internal */
export const OrgStatus$inboundSchema = z
    .nativeEnum(OrgStatus);
/** @internal */
export const OrgStatus$outboundSchema = OrgStatus$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var OrgStatus$;
(function (OrgStatus$) {
    /** @deprecated use `OrgStatus$inboundSchema` instead. */
    OrgStatus$.inboundSchema = OrgStatus$inboundSchema;
    /** @deprecated use `OrgStatus$outboundSchema` instead. */
    OrgStatus$.outboundSchema = OrgStatus$outboundSchema;
})(OrgStatus$ || (OrgStatus$ = {}));
/** @internal */
export const OrgType1$inboundSchema = z
    .nativeEnum(OrgType1);
/** @internal */
export const OrgType1$outboundSchema = OrgType1$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var OrgType1$;
(function (OrgType1$) {
    /** @deprecated use `OrgType1$inboundSchema` instead. */
    OrgType1$.inboundSchema = OrgType1$inboundSchema;
    /** @deprecated use `OrgType1$outboundSchema` instead. */
    OrgType1$.outboundSchema = OrgType1$outboundSchema;
})(OrgType1$ || (OrgType1$ = {}));
/** @internal */
export const OrgParent$inboundSchema = z.object({
    href: z.string(),
    sourcedId: z.string(),
    type: z.string(),
});
/** @internal */
export const OrgParent$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 OrgParent$;
(function (OrgParent$) {
    /** @deprecated use `OrgParent$inboundSchema` instead. */
    OrgParent$.inboundSchema = OrgParent$inboundSchema;
    /** @deprecated use `OrgParent$outboundSchema` instead. */
    OrgParent$.outboundSchema = OrgParent$outboundSchema;
})(OrgParent$ || (OrgParent$ = {}));
export function orgParentToJSON(orgParent) {
    return JSON.stringify(OrgParent$outboundSchema.parse(orgParent));
}
export function orgParentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OrgParent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrgParent' from JSON`);
}
/** @internal */
export const Child$inboundSchema = z
    .object({
    href: z.string(),
    sourcedId: z.string(),
    type: z.string(),
});
/** @internal */
export const Child$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 Child$;
(function (Child$) {
    /** @deprecated use `Child$inboundSchema` instead. */
    Child$.inboundSchema = Child$inboundSchema;
    /** @deprecated use `Child$outboundSchema` instead. */
    Child$.outboundSchema = Child$outboundSchema;
})(Child$ || (Child$ = {}));
export function childToJSON(child) {
    return JSON.stringify(Child$outboundSchema.parse(child));
}
export function childFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Child$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Child' from JSON`);
}
/** @internal */
export const Org$inboundSchema = z
    .object({
    sourcedId: z.string(),
    status: OrgStatus$inboundSchema,
    dateLastModified: z.string().datetime({ offset: true }).transform(v => new Date(v)).optional(),
    metadata: z.nullable(z.record(z.any())).optional(),
    name: z.string(),
    type: OrgType1$inboundSchema,
    identifier: z.string(),
    parent: z.nullable(z.lazy(() => OrgParent$inboundSchema)),
    children: z.array(z.lazy(() => Child$inboundSchema)),
});
/** @internal */
export const Org$outboundSchema = z
    .object({
    sourcedId: z.string(),
    status: OrgStatus$outboundSchema,
    dateLastModified: z.date().transform(v => v.toISOString()).optional(),
    metadata: z.nullable(z.record(z.any())).optional(),
    name: z.string(),
    type: OrgType1$outboundSchema,
    identifier: z.string(),
    parent: z.nullable(z.lazy(() => OrgParent$outboundSchema)),
    children: z.array(z.lazy(() => Child$outboundSchema)),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Org$;
(function (Org$) {
    /** @deprecated use `Org$inboundSchema` instead. */
    Org$.inboundSchema = Org$inboundSchema;
    /** @deprecated use `Org$outboundSchema` instead. */
    Org$.outboundSchema = Org$outboundSchema;
})(Org$ || (Org$ = {}));
export function orgToJSON(org) {
    return JSON.stringify(Org$outboundSchema.parse(org));
}
export function orgFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Org$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Org' from JSON`);
}
//# sourceMappingURL=org.js.map