"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.iamRoleFromJSON = exports.iamRoleToJSON = exports.IamRole$ = exports.IamRole$outboundSchema = exports.IamRole$inboundSchema = exports.iamRoleTypeFromJSON = exports.iamRoleTypeToJSON = exports.IamRoleType$ = exports.IamRoleType$outboundSchema = exports.IamRoleType$inboundSchema = exports.IamRoleValue$ = exports.IamRoleValue$outboundSchema = exports.IamRoleValue$inboundSchema = exports.iamRoleSourceValueFromJSON = exports.iamRoleSourceValueToJSON = exports.IamRoleSourceValue$ = exports.IamRoleSourceValue$outboundSchema = exports.IamRoleSourceValue$inboundSchema = exports.iamRole4FromJSON = exports.iamRole4ToJSON = exports.IamRole4$ = exports.IamRole4$outboundSchema = exports.IamRole4$inboundSchema = exports.IamRoleValue = 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 iampolicy_js_1 = require("./iampolicy.js");
var IamRoleValue;
(function (IamRoleValue) {
    IamRoleValue["Admin"] = "admin";
    IamRoleValue["Viewer"] = "viewer";
    IamRoleValue["Editor"] = "editor";
    IamRoleValue["Basic"] = "basic";
    IamRoleValue["Guest"] = "guest";
    IamRoleValue["Unassigned"] = "unassigned";
    IamRoleValue["Restricted"] = "restricted";
    IamRoleValue["UnmappedValue"] = "unmapped_value";
})(IamRoleValue || (exports.IamRoleValue = IamRoleValue = {}));
/** @internal */
exports.IamRole4$inboundSchema = z.object({});
/** @internal */
exports.IamRole4$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 IamRole4$;
(function (IamRole4$) {
    /** @deprecated use `IamRole4$inboundSchema` instead. */
    IamRole4$.inboundSchema = exports.IamRole4$inboundSchema;
    /** @deprecated use `IamRole4$outboundSchema` instead. */
    IamRole4$.outboundSchema = exports.IamRole4$outboundSchema;
})(IamRole4$ || (exports.IamRole4$ = IamRole4$ = {}));
function iamRole4ToJSON(iamRole4) {
    return JSON.stringify(exports.IamRole4$outboundSchema.parse(iamRole4));
}
exports.iamRole4ToJSON = iamRole4ToJSON;
function iamRole4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IamRole4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IamRole4' from JSON`);
}
exports.iamRole4FromJSON = iamRole4FromJSON;
/** @internal */
exports.IamRoleSourceValue$inboundSchema = z.union([
    z.lazy(() => exports.IamRole4$inboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/** @internal */
exports.IamRoleSourceValue$outboundSchema = z.union([
    z.lazy(() => exports.IamRole4$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 IamRoleSourceValue$;
(function (IamRoleSourceValue$) {
    /** @deprecated use `IamRoleSourceValue$inboundSchema` instead. */
    IamRoleSourceValue$.inboundSchema = exports.IamRoleSourceValue$inboundSchema;
    /** @deprecated use `IamRoleSourceValue$outboundSchema` instead. */
    IamRoleSourceValue$.outboundSchema = exports.IamRoleSourceValue$outboundSchema;
})(IamRoleSourceValue$ || (exports.IamRoleSourceValue$ = IamRoleSourceValue$ = {}));
function iamRoleSourceValueToJSON(iamRoleSourceValue) {
    return JSON.stringify(exports.IamRoleSourceValue$outboundSchema.parse(iamRoleSourceValue));
}
exports.iamRoleSourceValueToJSON = iamRoleSourceValueToJSON;
function iamRoleSourceValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IamRoleSourceValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IamRoleSourceValue' from JSON`);
}
exports.iamRoleSourceValueFromJSON = iamRoleSourceValueFromJSON;
/** @internal */
exports.IamRoleValue$inboundSchema = z
    .union([
    z.nativeEnum(IamRoleValue),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.IamRoleValue$outboundSchema = z.union([
    z.nativeEnum(IamRoleValue),
    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 IamRoleValue$;
(function (IamRoleValue$) {
    /** @deprecated use `IamRoleValue$inboundSchema` instead. */
    IamRoleValue$.inboundSchema = exports.IamRoleValue$inboundSchema;
    /** @deprecated use `IamRoleValue$outboundSchema` instead. */
    IamRoleValue$.outboundSchema = exports.IamRoleValue$outboundSchema;
})(IamRoleValue$ || (exports.IamRoleValue$ = IamRoleValue$ = {}));
/** @internal */
exports.IamRoleType$inboundSchema = z.object({
    source_value: z.nullable(z.union([
        z.lazy(() => exports.IamRole4$inboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.IamRoleValue$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "source_value": "sourceValue",
    });
});
/** @internal */
exports.IamRoleType$outboundSchema = z.object({
    sourceValue: z.nullable(z.union([
        z.lazy(() => exports.IamRole4$outboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.IamRoleValue$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 IamRoleType$;
(function (IamRoleType$) {
    /** @deprecated use `IamRoleType$inboundSchema` instead. */
    IamRoleType$.inboundSchema = exports.IamRoleType$inboundSchema;
    /** @deprecated use `IamRoleType$outboundSchema` instead. */
    IamRoleType$.outboundSchema = exports.IamRoleType$outboundSchema;
})(IamRoleType$ || (exports.IamRoleType$ = IamRoleType$ = {}));
function iamRoleTypeToJSON(iamRoleType) {
    return JSON.stringify(exports.IamRoleType$outboundSchema.parse(iamRoleType));
}
exports.iamRoleTypeToJSON = iamRoleTypeToJSON;
function iamRoleTypeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IamRoleType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IamRoleType' from JSON`);
}
exports.iamRoleTypeFromJSON = iamRoleTypeFromJSON;
/** @internal */
exports.IamRole$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(),
    policies: z.nullable(z.array(iampolicy_js_1.IamPolicy$inboundSchema)).optional(),
    remote_id: z.nullable(z.string()).optional(),
    type: z.nullable(z.lazy(() => exports.IamRoleType$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.IamRole$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(),
    policies: z.nullable(z.array(iampolicy_js_1.IamPolicy$outboundSchema)).optional(),
    remoteId: z.nullable(z.string()).optional(),
    type: z.nullable(z.lazy(() => exports.IamRoleType$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 IamRole$;
(function (IamRole$) {
    /** @deprecated use `IamRole$inboundSchema` instead. */
    IamRole$.inboundSchema = exports.IamRole$inboundSchema;
    /** @deprecated use `IamRole$outboundSchema` instead. */
    IamRole$.outboundSchema = exports.IamRole$outboundSchema;
})(IamRole$ || (exports.IamRole$ = IamRole$ = {}));
function iamRoleToJSON(iamRole) {
    return JSON.stringify(exports.IamRole$outboundSchema.parse(iamRole));
}
exports.iamRoleToJSON = iamRoleToJSON;
function iamRoleFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.IamRole$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IamRole' from JSON`);
}
exports.iamRoleFromJSON = iamRoleFromJSON;
//# sourceMappingURL=iamrole.js.map