/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { safeParse } from "../lib/schemas.js";
export const LimitedBy = {
    Saml: "saml",
    Mfa: "mfa",
};
export const Role = {
    Owner: "OWNER",
    Member: "MEMBER",
    Developer: "DEVELOPER",
    Security: "SECURITY",
    Billing: "BILLING",
    Viewer: "VIEWER",
    Contributor: "CONTRIBUTOR",
};
export const TeamRoles = {
    Owner: "OWNER",
    Member: "MEMBER",
    Developer: "DEVELOPER",
    Security: "SECURITY",
    Billing: "BILLING",
    Viewer: "VIEWER",
    Contributor: "CONTRIBUTOR",
};
export const TeamPermissions = {
    CreateProject: "CreateProject",
    FullProductionDeployment: "FullProductionDeployment",
    UsageViewer: "UsageViewer",
    EnvVariableManager: "EnvVariableManager",
    EnvironmentManager: "EnvironmentManager",
};
export const Origin = {
    Link: "link",
    Saml: "saml",
    Github: "github",
    Gitlab: "gitlab",
    Bitbucket: "bitbucket",
    Mail: "mail",
    Import: "import",
    Teams: "teams",
    Dsync: "dsync",
    Feedback: "feedback",
    OrganizationTeams: "organization-teams",
};
/** @internal */
export const LimitedBy$inboundSchema = z
    .nativeEnum(LimitedBy);
/** @internal */
export const LimitedBy$outboundSchema = LimitedBy$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var LimitedBy$;
(function (LimitedBy$) {
    /** @deprecated use `LimitedBy$inboundSchema` instead. */
    LimitedBy$.inboundSchema = LimitedBy$inboundSchema;
    /** @deprecated use `LimitedBy$outboundSchema` instead. */
    LimitedBy$.outboundSchema = LimitedBy$outboundSchema;
})(LimitedBy$ || (LimitedBy$ = {}));
/** @internal */
export const Connection$inboundSchema = z.object({
    type: z.string(),
    status: z.string(),
    state: z.string(),
    connectedAt: z.number(),
    lastReceivedWebhookEvent: z.number().optional(),
});
/** @internal */
export const Connection$outboundSchema = z.object({
    type: z.string(),
    status: z.string(),
    state: z.string(),
    connectedAt: z.number(),
    lastReceivedWebhookEvent: z.number().optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Connection$;
(function (Connection$) {
    /** @deprecated use `Connection$inboundSchema` instead. */
    Connection$.inboundSchema = Connection$inboundSchema;
    /** @deprecated use `Connection$outboundSchema` instead. */
    Connection$.outboundSchema = Connection$outboundSchema;
})(Connection$ || (Connection$ = {}));
export function connectionToJSON(connection) {
    return JSON.stringify(Connection$outboundSchema.parse(connection));
}
export function connectionFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Connection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Connection' from JSON`);
}
/** @internal */
export const Directory$inboundSchema = z.object({
    type: z.string(),
    state: z.string(),
    connectedAt: z.number(),
    lastReceivedWebhookEvent: z.number().optional(),
});
/** @internal */
export const Directory$outboundSchema = z.object({
    type: z.string(),
    state: z.string(),
    connectedAt: z.number(),
    lastReceivedWebhookEvent: z.number().optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Directory$;
(function (Directory$) {
    /** @deprecated use `Directory$inboundSchema` instead. */
    Directory$.inboundSchema = Directory$inboundSchema;
    /** @deprecated use `Directory$outboundSchema` instead. */
    Directory$.outboundSchema = Directory$outboundSchema;
})(Directory$ || (Directory$ = {}));
export function directoryToJSON(directory) {
    return JSON.stringify(Directory$outboundSchema.parse(directory));
}
export function directoryFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Directory$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Directory' from JSON`);
}
/** @internal */
export const Saml$inboundSchema = z
    .object({
    connection: z.lazy(() => Connection$inboundSchema).optional(),
    directory: z.lazy(() => Directory$inboundSchema).optional(),
    enforced: z.boolean(),
});
/** @internal */
export const Saml$outboundSchema = z.object({
    connection: z.lazy(() => Connection$outboundSchema).optional(),
    directory: z.lazy(() => Directory$outboundSchema).optional(),
    enforced: z.boolean(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Saml$;
(function (Saml$) {
    /** @deprecated use `Saml$inboundSchema` instead. */
    Saml$.inboundSchema = Saml$inboundSchema;
    /** @deprecated use `Saml$outboundSchema` instead. */
    Saml$.outboundSchema = Saml$outboundSchema;
})(Saml$ || (Saml$ = {}));
export function samlToJSON(saml) {
    return JSON.stringify(Saml$outboundSchema.parse(saml));
}
export function samlFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Saml$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Saml' from JSON`);
}
/** @internal */
export const Entitlements$inboundSchema = z.object({
    entitlement: z.string(),
});
/** @internal */
export const Entitlements$outboundSchema = z.object({
    entitlement: 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 Entitlements$;
(function (Entitlements$) {
    /** @deprecated use `Entitlements$inboundSchema` instead. */
    Entitlements$.inboundSchema = Entitlements$inboundSchema;
    /** @deprecated use `Entitlements$outboundSchema` instead. */
    Entitlements$.outboundSchema = Entitlements$outboundSchema;
})(Entitlements$ || (Entitlements$ = {}));
export function entitlementsToJSON(entitlements) {
    return JSON.stringify(Entitlements$outboundSchema.parse(entitlements));
}
export function entitlementsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Entitlements$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Entitlements' from JSON`);
}
/** @internal */
export const Role$inboundSchema = z.nativeEnum(Role);
/** @internal */
export const Role$outboundSchema = Role$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Role$;
(function (Role$) {
    /** @deprecated use `Role$inboundSchema` instead. */
    Role$.inboundSchema = Role$inboundSchema;
    /** @deprecated use `Role$outboundSchema` instead. */
    Role$.outboundSchema = Role$outboundSchema;
})(Role$ || (Role$ = {}));
/** @internal */
export const TeamRoles$inboundSchema = z
    .nativeEnum(TeamRoles);
/** @internal */
export const TeamRoles$outboundSchema = TeamRoles$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var TeamRoles$;
(function (TeamRoles$) {
    /** @deprecated use `TeamRoles$inboundSchema` instead. */
    TeamRoles$.inboundSchema = TeamRoles$inboundSchema;
    /** @deprecated use `TeamRoles$outboundSchema` instead. */
    TeamRoles$.outboundSchema = TeamRoles$outboundSchema;
})(TeamRoles$ || (TeamRoles$ = {}));
/** @internal */
export const TeamPermissions$inboundSchema = z.nativeEnum(TeamPermissions);
/** @internal */
export const TeamPermissions$outboundSchema = TeamPermissions$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var TeamPermissions$;
(function (TeamPermissions$) {
    /** @deprecated use `TeamPermissions$inboundSchema` instead. */
    TeamPermissions$.inboundSchema = TeamPermissions$inboundSchema;
    /** @deprecated use `TeamPermissions$outboundSchema` instead. */
    TeamPermissions$.outboundSchema = TeamPermissions$outboundSchema;
})(TeamPermissions$ || (TeamPermissions$ = {}));
/** @internal */
export const Origin$inboundSchema = z
    .nativeEnum(Origin);
/** @internal */
export const Origin$outboundSchema = Origin$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Origin$;
(function (Origin$) {
    /** @deprecated use `Origin$inboundSchema` instead. */
    Origin$.inboundSchema = Origin$inboundSchema;
    /** @deprecated use `Origin$outboundSchema` instead. */
    Origin$.outboundSchema = Origin$outboundSchema;
})(Origin$ || (Origin$ = {}));
/** @internal */
export const GitUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const GitUserId$outboundSchema = z.union([z.string(), z.number()]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var GitUserId$;
(function (GitUserId$) {
    /** @deprecated use `GitUserId$inboundSchema` instead. */
    GitUserId$.inboundSchema = GitUserId$inboundSchema;
    /** @deprecated use `GitUserId$outboundSchema` instead. */
    GitUserId$.outboundSchema = GitUserId$outboundSchema;
})(GitUserId$ || (GitUserId$ = {}));
export function gitUserIdToJSON(gitUserId) {
    return JSON.stringify(GitUserId$outboundSchema.parse(gitUserId));
}
export function gitUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => GitUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GitUserId' from JSON`);
}
/** @internal */
export const JoinedFrom$inboundSchema = z.object({
    origin: Origin$inboundSchema,
    commitId: z.string().optional(),
    repoId: z.string().optional(),
    repoPath: z.string().optional(),
    gitUserId: z.union([z.string(), z.number()]).optional(),
    gitUserLogin: z.string().optional(),
    ssoUserId: z.string().optional(),
    ssoConnectedAt: z.number().optional(),
    idpUserId: z.string().optional(),
    dsyncUserId: z.string().optional(),
    dsyncConnectedAt: z.number().optional(),
});
/** @internal */
export const JoinedFrom$outboundSchema = z.object({
    origin: Origin$outboundSchema,
    commitId: z.string().optional(),
    repoId: z.string().optional(),
    repoPath: z.string().optional(),
    gitUserId: z.union([z.string(), z.number()]).optional(),
    gitUserLogin: z.string().optional(),
    ssoUserId: z.string().optional(),
    ssoConnectedAt: z.number().optional(),
    idpUserId: z.string().optional(),
    dsyncUserId: z.string().optional(),
    dsyncConnectedAt: z.number().optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var JoinedFrom$;
(function (JoinedFrom$) {
    /** @deprecated use `JoinedFrom$inboundSchema` instead. */
    JoinedFrom$.inboundSchema = JoinedFrom$inboundSchema;
    /** @deprecated use `JoinedFrom$outboundSchema` instead. */
    JoinedFrom$.outboundSchema = JoinedFrom$outboundSchema;
})(JoinedFrom$ || (JoinedFrom$ = {}));
export function joinedFromToJSON(joinedFrom) {
    return JSON.stringify(JoinedFrom$outboundSchema.parse(joinedFrom));
}
export function joinedFromFromJSON(jsonString) {
    return safeParse(jsonString, (x) => JoinedFrom$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'JoinedFrom' from JSON`);
}
/** @internal */
export const Membership$inboundSchema = z.object({
    uid: z.string().optional(),
    entitlements: z.array(z.lazy(() => Entitlements$inboundSchema)).optional(),
    confirmed: z.boolean(),
    confirmedAt: z.number(),
    accessRequestedAt: z.number().optional(),
    role: Role$inboundSchema,
    teamRoles: z.array(TeamRoles$inboundSchema).optional(),
    teamPermissions: z.array(TeamPermissions$inboundSchema).optional(),
    teamId: z.string().optional(),
    createdAt: z.number(),
    created: z.number(),
    joinedFrom: z.lazy(() => JoinedFrom$inboundSchema).optional(),
});
/** @internal */
export const Membership$outboundSchema = z.object({
    uid: z.string().optional(),
    entitlements: z.array(z.lazy(() => Entitlements$outboundSchema)).optional(),
    confirmed: z.boolean(),
    confirmedAt: z.number(),
    accessRequestedAt: z.number().optional(),
    role: Role$outboundSchema,
    teamRoles: z.array(TeamRoles$outboundSchema).optional(),
    teamPermissions: z.array(TeamPermissions$outboundSchema).optional(),
    teamId: z.string().optional(),
    createdAt: z.number(),
    created: z.number(),
    joinedFrom: z.lazy(() => JoinedFrom$outboundSchema).optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Membership$;
(function (Membership$) {
    /** @deprecated use `Membership$inboundSchema` instead. */
    Membership$.inboundSchema = Membership$inboundSchema;
    /** @deprecated use `Membership$outboundSchema` instead. */
    Membership$.outboundSchema = Membership$outboundSchema;
})(Membership$ || (Membership$ = {}));
export function membershipToJSON(membership) {
    return JSON.stringify(Membership$outboundSchema.parse(membership));
}
export function membershipFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Membership$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Membership' from JSON`);
}
/** @internal */
export const TeamLimited$inboundSchema = z.object({
    limited: z.boolean(),
    limitedBy: z.array(LimitedBy$inboundSchema),
    saml: z.lazy(() => Saml$inboundSchema).optional(),
    mfaEnforced: z.boolean().optional(),
    id: z.string(),
    slug: z.string(),
    name: z.nullable(z.string()),
    avatar: z.nullable(z.string()),
    membership: z.lazy(() => Membership$inboundSchema),
    created: z.string(),
    createdAt: z.number(),
});
/** @internal */
export const TeamLimited$outboundSchema = z.object({
    limited: z.boolean(),
    limitedBy: z.array(LimitedBy$outboundSchema),
    saml: z.lazy(() => Saml$outboundSchema).optional(),
    mfaEnforced: z.boolean().optional(),
    id: z.string(),
    slug: z.string(),
    name: z.nullable(z.string()),
    avatar: z.nullable(z.string()),
    membership: z.lazy(() => Membership$outboundSchema),
    created: z.string(),
    createdAt: z.number(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var TeamLimited$;
(function (TeamLimited$) {
    /** @deprecated use `TeamLimited$inboundSchema` instead. */
    TeamLimited$.inboundSchema = TeamLimited$inboundSchema;
    /** @deprecated use `TeamLimited$outboundSchema` instead. */
    TeamLimited$.outboundSchema = TeamLimited$outboundSchema;
})(TeamLimited$ || (TeamLimited$ = {}));
export function teamLimitedToJSON(teamLimited) {
    return JSON.stringify(TeamLimited$outboundSchema.parse(teamLimited));
}
export function teamLimitedFromJSON(jsonString) {
    return safeParse(jsonString, (x) => TeamLimited$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TeamLimited' from JSON`);
}
//# sourceMappingURL=teamlimited.js.map