/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
export const ResourceStatus = {
    Active: "active",
    Tobedeleted: "tobedeleted",
};
export const ResourceRole = {
    Primary: "primary",
    Secondary: "secondary",
};
export const Importance = {
    Primary: "primary",
    Secondary: "secondary",
};
/** @internal */
export const ResourceStatus$inboundSchema = z.nativeEnum(ResourceStatus);
/** @internal */
export const ResourceStatus$outboundSchema = ResourceStatus$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var ResourceStatus$;
(function (ResourceStatus$) {
    /** @deprecated use `ResourceStatus$inboundSchema` instead. */
    ResourceStatus$.inboundSchema = ResourceStatus$inboundSchema;
    /** @deprecated use `ResourceStatus$outboundSchema` instead. */
    ResourceStatus$.outboundSchema = ResourceStatus$outboundSchema;
})(ResourceStatus$ || (ResourceStatus$ = {}));
/** @internal */
export const ResourceRole$inboundSchema = z.nativeEnum(ResourceRole);
/** @internal */
export const ResourceRole$outboundSchema = ResourceRole$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var ResourceRole$;
(function (ResourceRole$) {
    /** @deprecated use `ResourceRole$inboundSchema` instead. */
    ResourceRole$.inboundSchema = ResourceRole$inboundSchema;
    /** @deprecated use `ResourceRole$outboundSchema` instead. */
    ResourceRole$.outboundSchema = ResourceRole$outboundSchema;
})(ResourceRole$ || (ResourceRole$ = {}));
/** @internal */
export const Importance$inboundSchema = z
    .nativeEnum(Importance);
/** @internal */
export const Importance$outboundSchema = Importance$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Importance$;
(function (Importance$) {
    /** @deprecated use `Importance$inboundSchema` instead. */
    Importance$.inboundSchema = Importance$inboundSchema;
    /** @deprecated use `Importance$outboundSchema` instead. */
    Importance$.outboundSchema = Importance$outboundSchema;
})(Importance$ || (Importance$ = {}));
/** @internal */
export const Resource$inboundSchema = z.object({
    sourcedId: z.string(),
    status: ResourceStatus$inboundSchema,
    dateLastModified: z.string().datetime({ offset: true }).transform(v => new Date(v)).optional(),
    metadata: z.nullable(z.record(z.any())).optional(),
    title: z.string(),
    roles: z.array(ResourceRole$inboundSchema).optional(),
    importance: Importance$inboundSchema.optional(),
    vendorResourceId: z.string(),
    vendorId: z.nullable(z.string()).optional(),
    applicationId: z.nullable(z.string()).optional(),
});
/** @internal */
export const Resource$outboundSchema = z.object({
    sourcedId: z.string(),
    status: ResourceStatus$outboundSchema,
    dateLastModified: z.date().transform(v => v.toISOString()).optional(),
    metadata: z.nullable(z.record(z.any())).optional(),
    title: z.string(),
    roles: z.array(ResourceRole$outboundSchema).optional(),
    importance: Importance$outboundSchema.optional(),
    vendorResourceId: z.string(),
    vendorId: z.nullable(z.string()).optional(),
    applicationId: z.nullable(z.string()).optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Resource$;
(function (Resource$) {
    /** @deprecated use `Resource$inboundSchema` instead. */
    Resource$.inboundSchema = Resource$inboundSchema;
    /** @deprecated use `Resource$outboundSchema` instead. */
    Resource$.outboundSchema = Resource$outboundSchema;
})(Resource$ || (Resource$ = {}));
export function resourceToJSON(resource) {
    return JSON.stringify(Resource$outboundSchema.parse(resource));
}
export function resourceFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Resource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Resource' from JSON`);
}
//# sourceMappingURL=resource.js.map