"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.iamPermissionFromJSON = exports.iamPermissionToJSON = exports.IamPermission$ = exports.IamPermission$outboundSchema = exports.IamPermission$inboundSchema = exports.iamPermissionTypeFromJSON = exports.iamPermissionTypeToJSON = exports.IamPermissionType$ = exports.IamPermissionType$outboundSchema = exports.IamPermissionType$inboundSchema = exports.IamPermissionValue$ = exports.IamPermissionValue$outboundSchema = exports.IamPermissionValue$inboundSchema = exports.iamPermissionSourceValueFromJSON = exports.iamPermissionSourceValueToJSON = exports.IamPermissionSourceValue$ = exports.IamPermissionSourceValue$outboundSchema = exports.IamPermissionSourceValue$inboundSchema = exports.iamPermission4FromJSON = exports.iamPermission4ToJSON = exports.IamPermission4$ = exports.IamPermission4$outboundSchema = exports.IamPermission4$inboundSchema = exports.IamPermissionValue = 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 iamresource_js_1 = require("./iamresource.js");
/**
 * The type of the permission, e.g. read, read_write, delete, etc.
 */
var IamPermissionValue;
(function (IamPermissionValue) {
    IamPermissionValue["Read"] = "read";
    IamPermissionValue["ReadWrite"] = "read_write";
    IamPermissionValue["Approve"] = "approve";
    IamPermissionValue["Delete"] = "delete";
    IamPermissionValue["Use"] = "use";
    IamPermissionValue["Export"] = "export";
    IamPermissionValue["UnmappedValue"] = "unmapped_value";
})(IamPermissionValue || (exports.IamPermissionValue = IamPermissionValue = {}));
/** @internal */
exports.IamPermission4$inboundSchema = z.object({});
/** @internal */
exports.IamPermission4$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 IamPermission4$;
(function (IamPermission4$) {
    /** @deprecated use `IamPermission4$inboundSchema` instead. */
    IamPermission4$.inboundSchema = exports.IamPermission4$inboundSchema;
    /** @deprecated use `IamPermission4$outboundSchema` instead. */
    IamPermission4$.outboundSchema = exports.IamPermission4$outboundSchema;
})(IamPermission4$ || (exports.IamPermission4$ = IamPermission4$ = {}));
function iamPermission4ToJSON(iamPermission4) {
    return JSON.stringify(exports.IamPermission4$outboundSchema.parse(iamPermission4));
}
exports.iamPermission4ToJSON = iamPermission4ToJSON;
function iamPermission4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IamPermission4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IamPermission4' from JSON`);
}
exports.iamPermission4FromJSON = iamPermission4FromJSON;
/** @internal */
exports.IamPermissionSourceValue$inboundSchema = z.union([
    z.lazy(() => exports.IamPermission4$inboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/** @internal */
exports.IamPermissionSourceValue$outboundSchema = z.union([
    z.lazy(() => exports.IamPermission4$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 IamPermissionSourceValue$;
(function (IamPermissionSourceValue$) {
    /** @deprecated use `IamPermissionSourceValue$inboundSchema` instead. */
    IamPermissionSourceValue$.inboundSchema = exports.IamPermissionSourceValue$inboundSchema;
    /** @deprecated use `IamPermissionSourceValue$outboundSchema` instead. */
    IamPermissionSourceValue$.outboundSchema = exports.IamPermissionSourceValue$outboundSchema;
})(IamPermissionSourceValue$ || (exports.IamPermissionSourceValue$ = IamPermissionSourceValue$ = {}));
function iamPermissionSourceValueToJSON(iamPermissionSourceValue) {
    return JSON.stringify(exports.IamPermissionSourceValue$outboundSchema.parse(iamPermissionSourceValue));
}
exports.iamPermissionSourceValueToJSON = iamPermissionSourceValueToJSON;
function iamPermissionSourceValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IamPermissionSourceValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IamPermissionSourceValue' from JSON`);
}
exports.iamPermissionSourceValueFromJSON = iamPermissionSourceValueFromJSON;
/** @internal */
exports.IamPermissionValue$inboundSchema = z
    .union([
    z.nativeEnum(IamPermissionValue),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.IamPermissionValue$outboundSchema = z.union([
    z.nativeEnum(IamPermissionValue),
    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 IamPermissionValue$;
(function (IamPermissionValue$) {
    /** @deprecated use `IamPermissionValue$inboundSchema` instead. */
    IamPermissionValue$.inboundSchema = exports.IamPermissionValue$inboundSchema;
    /** @deprecated use `IamPermissionValue$outboundSchema` instead. */
    IamPermissionValue$.outboundSchema = exports.IamPermissionValue$outboundSchema;
})(IamPermissionValue$ || (exports.IamPermissionValue$ = IamPermissionValue$ = {}));
/** @internal */
exports.IamPermissionType$inboundSchema = z.object({
    source_value: z.nullable(z.union([
        z.lazy(() => exports.IamPermission4$inboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.IamPermissionValue$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "source_value": "sourceValue",
    });
});
/** @internal */
exports.IamPermissionType$outboundSchema = z.object({
    sourceValue: z.nullable(z.union([
        z.lazy(() => exports.IamPermission4$outboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.IamPermissionValue$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 IamPermissionType$;
(function (IamPermissionType$) {
    /** @deprecated use `IamPermissionType$inboundSchema` instead. */
    IamPermissionType$.inboundSchema = exports.IamPermissionType$inboundSchema;
    /** @deprecated use `IamPermissionType$outboundSchema` instead. */
    IamPermissionType$.outboundSchema = exports.IamPermissionType$outboundSchema;
})(IamPermissionType$ || (exports.IamPermissionType$ = IamPermissionType$ = {}));
function iamPermissionTypeToJSON(iamPermissionType) {
    return JSON.stringify(exports.IamPermissionType$outboundSchema.parse(iamPermissionType));
}
exports.iamPermissionTypeToJSON = iamPermissionTypeToJSON;
function iamPermissionTypeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IamPermissionType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IamPermissionType' from JSON`);
}
exports.iamPermissionTypeFromJSON = iamPermissionTypeFromJSON;
/** @internal */
exports.IamPermission$inboundSchema = z.object({
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    description: z.nullable(z.string()).optional(),
    id: z.nullable(z.string()).optional(),
    name: z.nullable(z.string()).optional(),
    remote_id: z.nullable(z.string()).optional(),
    resources: z.nullable(z.array(iamresource_js_1.IamResource$inboundSchema)).optional(),
    type: z.nullable(z.lazy(() => exports.IamPermissionType$inboundSchema)).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "created_at": "createdAt",
        "remote_id": "remoteId",
        "updated_at": "updatedAt",
    });
});
/** @internal */
exports.IamPermission$outboundSchema = z.object({
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    description: z.nullable(z.string()).optional(),
    id: z.nullable(z.string()).optional(),
    name: z.nullable(z.string()).optional(),
    remoteId: z.nullable(z.string()).optional(),
    resources: z.nullable(z.array(iamresource_js_1.IamResource$outboundSchema)).optional(),
    type: z.nullable(z.lazy(() => exports.IamPermissionType$outboundSchema)).optional(),
    updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        createdAt: "created_at",
        remoteId: "remote_id",
        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 IamPermission$;
(function (IamPermission$) {
    /** @deprecated use `IamPermission$inboundSchema` instead. */
    IamPermission$.inboundSchema = exports.IamPermission$inboundSchema;
    /** @deprecated use `IamPermission$outboundSchema` instead. */
    IamPermission$.outboundSchema = exports.IamPermission$outboundSchema;
})(IamPermission$ || (exports.IamPermission$ = IamPermission$ = {}));
function iamPermissionToJSON(iamPermission) {
    return JSON.stringify(exports.IamPermission$outboundSchema.parse(iamPermission));
}
exports.iamPermissionToJSON = iamPermissionToJSON;
function iamPermissionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IamPermission$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IamPermission' from JSON`);
}
exports.iamPermissionFromJSON = iamPermissionFromJSON;
//# sourceMappingURL=iampermission.js.map