/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
export const CreateDrainProjects = {
    Some: "some",
    All: "all",
};
export const FilterSources = {
    Build: "build",
    Edge: "edge",
    Lambda: "lambda",
    Static: "static",
    External: "external",
    Firewall: "firewall",
    Redirect: "redirect",
};
export const FilterEnvironments = {
    Production: "production",
    Preview: "preview",
};
export const CreateDrainDeliveryEncoding = {
    Proto: "proto",
    Json: "json",
};
export const Compression = {
    Gzip: "gzip",
    None: "none",
};
export const DeliveryEncoding = {
    Json: "json",
    Ndjson: "ndjson",
};
/**
 * Environment to apply sampling to
 */
export const Env = {
    Production: "production",
    Preview: "preview",
};
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBody2Type = {
    Internal: "internal",
};
export const CreateDrainDeliveryTarget = {
    VercelOtelTracesDb: "vercel-otel-traces-db",
};
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBodyType = {
    Clickhouse: "clickhouse",
};
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONType = {
    Otlphttp: "otlphttp",
};
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONEncoding = {
    Json: "json",
    Proto: "proto",
};
export const CreateDrainSecretDrainsResponseKind = {
    IntegrationSecret: "INTEGRATION_SECRET",
};
export const CreateDrainDeliveryDrainsResponse200Type = {
    Http: "http",
};
export const CreateDrainDeliveryDrainsResponse200Encoding = {
    Json: "json",
    Ndjson: "ndjson",
};
export const CreateDrainDeliveryCompression = {
    Gzip: "gzip",
    None: "none",
};
export const CreateDrainSecretDrainsKind = {
    IntegrationSecret: "INTEGRATION_SECRET",
};
export const CreateDrainResponseBodyDrainsType = {
    HeadSampling: "head_sampling",
};
export const CreateDrainResponseBodyEnv = {
    Production: "production",
    Preview: "preview",
};
export const CreateDrainResponseBodyDrainsStatus = {
    Enabled: "enabled",
    Disabled: "disabled",
    Errored: "errored",
};
export const ResponseBodyDisabledReason = {
    DisabledByOwner: "disabled-by-owner",
    FeatureNotAvailable: "feature-not-available",
    AccountPlanDowngrade: "account-plan-downgrade",
    DisabledByAdmin: "disabled-by-admin",
};
export const CreateDrainSourceDrainsKind = {
    Integration: "integration",
};
export const CreateDrainSourceKind = {
    SelfServed: "self-served",
};
export const CreateDrainFilterV2DrainsVersion = {
    V2: "v2",
};
export const CreateDrainFilterDrainsResponseType = {
    Odata: "odata",
};
export const CreateDrainFilterDrainsType = {
    Basic: "basic",
};
export const CreateDrainFilterDrainsSources = {
    Build: "build",
    Edge: "edge",
    Lambda: "lambda",
    Static: "static",
    External: "external",
    Firewall: "firewall",
    Redirect: "redirect",
};
export const CreateDrainFilterDrainsEnvironments = {
    Production: "production",
    Preview: "preview",
};
export const CreateDrainFilterV2Version = {
    V1: "v1",
};
export const ProjectAccessAccess = {
    Some: "some",
};
export const CreateDrainProjectAccessAccess = {
    All: "all",
};
export const CreateDrainDeliveryDrainsResponseType = {
    Internal: "internal",
};
export const DeliveryTarget = {
    VercelOtelTracesDb: "vercel-otel-traces-db",
};
export const CreateDrainDeliveryDrainsType = {
    Clickhouse: "clickhouse",
};
export const CreateDrainDeliveryType = {
    Otlphttp: "otlphttp",
};
export const CreateDrainDeliveryDrainsResponseEncoding = {
    Json: "json",
    Proto: "proto",
};
export const CreateDrainSecretKind = {
    IntegrationSecret: "INTEGRATION_SECRET",
};
export const DeliveryType = {
    Http: "http",
};
export const CreateDrainDeliveryDrainsEncoding = {
    Json: "json",
    Ndjson: "ndjson",
};
export const CreateDrainDeliveryDrainsCompression = {
    Gzip: "gzip",
    None: "none",
};
export const SecretKind = {
    IntegrationSecret: "INTEGRATION_SECRET",
};
export const CreateDrainResponseBodyType = {
    HeadSampling: "head_sampling",
};
export const ResponseBodyEnv = {
    Production: "production",
    Preview: "preview",
};
export const CreateDrainResponseBodyStatus = {
    Enabled: "enabled",
    Disabled: "disabled",
    Errored: "errored",
};
export const DisabledReason = {
    DisabledByOwner: "disabled-by-owner",
    FeatureNotAvailable: "feature-not-available",
    AccountPlanDowngrade: "account-plan-downgrade",
    DisabledByAdmin: "disabled-by-admin",
};
export const CreateDrainSourceDrainsResponse200Kind = {
    Integration: "integration",
};
export const CreateDrainSourceDrainsResponseKind = {
    SelfServed: "self-served",
};
export const FilterV2Version = {
    V2: "v2",
};
export const CreateDrainFilterType = {
    Odata: "odata",
};
export const FilterType = {
    Basic: "basic",
};
export const CreateDrainFilterSources = {
    Build: "build",
    Edge: "edge",
    Lambda: "lambda",
    Static: "static",
    External: "external",
    Firewall: "firewall",
    Redirect: "redirect",
};
export const CreateDrainFilterEnvironments = {
    Production: "production",
    Preview: "preview",
};
export const CreateDrainFilterV2DrainsResponseVersion = {
    V1: "v1",
};
/** @internal */
export const CreateDrainProjects$inboundSchema = z.nativeEnum(CreateDrainProjects);
/** @internal */
export const CreateDrainProjects$outboundSchema = CreateDrainProjects$inboundSchema;
/** @internal */
export const CreateDrainFilter2$inboundSchema = z.object({
    type: z.string(),
    text: z.string(),
});
/** @internal */
export const CreateDrainFilter2$outboundSchema = z.object({
    type: z.string(),
    text: z.string(),
});
export function createDrainFilter2ToJSON(createDrainFilter2) {
    return JSON.stringify(CreateDrainFilter2$outboundSchema.parse(createDrainFilter2));
}
export function createDrainFilter2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilter2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilter2' from JSON`);
}
/** @internal */
export const CreateDrainFilterProject$inboundSchema = z.object({
    ids: z.array(z.string()).optional(),
});
/** @internal */
export const CreateDrainFilterProject$outboundSchema = z.object({
    ids: z.array(z.string()).optional(),
});
export function createDrainFilterProjectToJSON(createDrainFilterProject) {
    return JSON.stringify(CreateDrainFilterProject$outboundSchema.parse(createDrainFilterProject));
}
export function createDrainFilterProjectFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterProject' from JSON`);
}
/** @internal */
export const FilterSources$inboundSchema = z.nativeEnum(FilterSources);
/** @internal */
export const FilterSources$outboundSchema = FilterSources$inboundSchema;
/** @internal */
export const Log$inboundSchema = z
    .object({
    sources: z.array(FilterSources$inboundSchema).optional(),
});
/** @internal */
export const Log$outboundSchema = z
    .object({
    sources: z.array(FilterSources$outboundSchema).optional(),
});
export function logToJSON(log) {
    return JSON.stringify(Log$outboundSchema.parse(log));
}
export function logFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Log$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Log' from JSON`);
}
/** @internal */
export const FilterEnvironments$inboundSchema = z.nativeEnum(FilterEnvironments);
/** @internal */
export const FilterEnvironments$outboundSchema = FilterEnvironments$inboundSchema;
/** @internal */
export const CreateDrainFilterDeployment$inboundSchema = z.object({
    environments: z.array(FilterEnvironments$inboundSchema).optional(),
});
/** @internal */
export const CreateDrainFilterDeployment$outboundSchema = z.object({
    environments: z.array(FilterEnvironments$outboundSchema).optional(),
});
export function createDrainFilterDeploymentToJSON(createDrainFilterDeployment) {
    return JSON.stringify(CreateDrainFilterDeployment$outboundSchema.parse(createDrainFilterDeployment));
}
export function createDrainFilterDeploymentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDeployment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDeployment' from JSON`);
}
/** @internal */
export const Filter1$inboundSchema = z.object({
    type: z.string(),
    project: z.lazy(() => CreateDrainFilterProject$inboundSchema).optional(),
    log: z.lazy(() => Log$inboundSchema).optional(),
    deployment: z.lazy(() => CreateDrainFilterDeployment$inboundSchema)
        .optional(),
});
/** @internal */
export const Filter1$outboundSchema = z.object({
    type: z.string(),
    project: z.lazy(() => CreateDrainFilterProject$outboundSchema).optional(),
    log: z.lazy(() => Log$outboundSchema).optional(),
    deployment: z.lazy(() => CreateDrainFilterDeployment$outboundSchema)
        .optional(),
});
export function filter1ToJSON(filter1) {
    return JSON.stringify(Filter1$outboundSchema.parse(filter1));
}
export function filter1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Filter1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Filter1' from JSON`);
}
/** @internal */
export const FilterFilter$inboundSchema = z.union([
    z.lazy(() => CreateDrainFilter2$inboundSchema),
    z.lazy(() => Filter1$inboundSchema),
]);
/** @internal */
export const FilterFilter$outboundSchema = z.union([
    z.lazy(() => CreateDrainFilter2$outboundSchema),
    z.lazy(() => Filter1$outboundSchema),
]);
export function filterFilterToJSON(filterFilter) {
    return JSON.stringify(FilterFilter$outboundSchema.parse(filterFilter));
}
export function filterFilterFromJSON(jsonString) {
    return safeParse(jsonString, (x) => FilterFilter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilterFilter' from JSON`);
}
/** @internal */
export const Filter2$inboundSchema = z.object({
    version: z.string(),
    filter: z.union([
        z.lazy(() => CreateDrainFilter2$inboundSchema),
        z.lazy(() => Filter1$inboundSchema),
    ]),
});
/** @internal */
export const Filter2$outboundSchema = z.object({
    version: z.string(),
    filter: z.union([
        z.lazy(() => CreateDrainFilter2$outboundSchema),
        z.lazy(() => Filter1$outboundSchema),
    ]),
});
export function filter2ToJSON(filter2) {
    return JSON.stringify(Filter2$outboundSchema.parse(filter2));
}
export function filter2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Filter2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Filter2' from JSON`);
}
/** @internal */
export const Filter$inboundSchema = z
    .union([z.lazy(() => Filter2$inboundSchema), z.string()]);
/** @internal */
export const Filter$outboundSchema = z.union([z.lazy(() => Filter2$outboundSchema), z.string()]);
export function filterToJSON(filter) {
    return JSON.stringify(Filter$outboundSchema.parse(filter));
}
export function filterFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Filter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Filter' from JSON`);
}
/** @internal */
export const Schemas$inboundSchema = z.object({
    version: z.string(),
});
/** @internal */
export const Schemas$outboundSchema = z.object({
    version: z.string(),
});
export function schemasToJSON(schemas) {
    return JSON.stringify(Schemas$outboundSchema.parse(schemas));
}
export function schemasFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Schemas$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Schemas' from JSON`);
}
/** @internal */
export const Endpoint1$inboundSchema = z.object({
    traces: z.string(),
});
/** @internal */
export const Endpoint1$outboundSchema = z.object({
    traces: z.string(),
});
export function endpoint1ToJSON(endpoint1) {
    return JSON.stringify(Endpoint1$outboundSchema.parse(endpoint1));
}
export function endpoint1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Endpoint1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Endpoint1' from JSON`);
}
/** @internal */
export const Endpoint$inboundSchema = z.lazy(() => Endpoint1$inboundSchema);
/** @internal */
export const Endpoint$outboundSchema = z.lazy(() => Endpoint1$outboundSchema);
export function endpointToJSON(endpoint) {
    return JSON.stringify(Endpoint$outboundSchema.parse(endpoint));
}
export function endpointFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Endpoint$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Endpoint' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryEncoding$inboundSchema = z.nativeEnum(CreateDrainDeliveryEncoding);
/** @internal */
export const CreateDrainDeliveryEncoding$outboundSchema = CreateDrainDeliveryEncoding$inboundSchema;
/** @internal */
export const Delivery2$inboundSchema = z.object({
    type: z.string(),
    endpoint: z.lazy(() => Endpoint1$inboundSchema),
    encoding: CreateDrainDeliveryEncoding$inboundSchema,
    headers: z.record(z.string()),
    secret: z.string().optional(),
});
/** @internal */
export const Delivery2$outboundSchema = z.object({
    type: z.string(),
    endpoint: z.lazy(() => Endpoint1$outboundSchema),
    encoding: CreateDrainDeliveryEncoding$outboundSchema,
    headers: z.record(z.string()),
    secret: z.string().optional(),
});
export function delivery2ToJSON(delivery2) {
    return JSON.stringify(Delivery2$outboundSchema.parse(delivery2));
}
export function delivery2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Delivery2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Delivery2' from JSON`);
}
/** @internal */
export const Compression$inboundSchema = z
    .nativeEnum(Compression);
/** @internal */
export const Compression$outboundSchema = Compression$inboundSchema;
/** @internal */
export const DeliveryEncoding$inboundSchema = z.nativeEnum(DeliveryEncoding);
/** @internal */
export const DeliveryEncoding$outboundSchema = DeliveryEncoding$inboundSchema;
/** @internal */
export const Delivery1$inboundSchema = z.object({
    type: z.string(),
    endpoint: z.string(),
    compression: Compression$inboundSchema.optional(),
    encoding: DeliveryEncoding$inboundSchema,
    headers: z.record(z.string()),
    secret: z.string().optional(),
});
/** @internal */
export const Delivery1$outboundSchema = z.object({
    type: z.string(),
    endpoint: z.string(),
    compression: Compression$outboundSchema.optional(),
    encoding: DeliveryEncoding$outboundSchema,
    headers: z.record(z.string()),
    secret: z.string().optional(),
});
export function delivery1ToJSON(delivery1) {
    return JSON.stringify(Delivery1$outboundSchema.parse(delivery1));
}
export function delivery1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Delivery1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Delivery1' from JSON`);
}
/** @internal */
export const Delivery$inboundSchema = z.union([
    z.lazy(() => Delivery1$inboundSchema),
    z.lazy(() => Delivery2$inboundSchema),
]);
/** @internal */
export const Delivery$outboundSchema = z.union([
    z.lazy(() => Delivery1$outboundSchema),
    z.lazy(() => Delivery2$outboundSchema),
]);
export function deliveryToJSON(delivery) {
    return JSON.stringify(Delivery$outboundSchema.parse(delivery));
}
export function deliveryFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Delivery$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Delivery' from JSON`);
}
/** @internal */
export const Env$inboundSchema = z.nativeEnum(Env);
/** @internal */
export const Env$outboundSchema = Env$inboundSchema;
/** @internal */
export const Sampling$inboundSchema = z.object({
    type: z.string(),
    rate: z.number(),
    env: Env$inboundSchema.optional(),
    requestPath: z.string().optional(),
});
/** @internal */
export const Sampling$outboundSchema = z.object({
    type: z.string(),
    rate: z.number(),
    env: Env$outboundSchema.optional(),
    requestPath: z.string().optional(),
});
export function samplingToJSON(sampling) {
    return JSON.stringify(Sampling$outboundSchema.parse(sampling));
}
export function samplingFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Sampling$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Sampling' from JSON`);
}
/** @internal */
export const Transforms$inboundSchema = z.object({
    id: z.string(),
});
/** @internal */
export const Transforms$outboundSchema = z.object({
    id: z.string(),
});
export function transformsToJSON(transforms) {
    return JSON.stringify(Transforms$outboundSchema.parse(transforms));
}
export function transformsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Transforms$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Transforms' from JSON`);
}
/** @internal */
export const Source2$inboundSchema = z.object({
    kind: z.string().default("self-served"),
});
/** @internal */
export const Source2$outboundSchema = z.object({
    kind: z.string().default("self-served"),
});
export function source2ToJSON(source2) {
    return JSON.stringify(Source2$outboundSchema.parse(source2));
}
export function source2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Source2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Source2' from JSON`);
}
/** @internal */
export const One3$inboundSchema = z
    .object({
    kind: z.string().default("integration"),
});
/** @internal */
export const One3$outboundSchema = z.object({
    kind: z.string().default("integration"),
});
export function one3ToJSON(one3) {
    return JSON.stringify(One3$outboundSchema.parse(one3));
}
export function one3FromJSON(jsonString) {
    return safeParse(jsonString, (x) => One3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'One3' from JSON`);
}
/** @internal */
export const One2$inboundSchema = z
    .object({
    kind: z.string().default("integration"),
    resourceId: z.string(),
});
/** @internal */
export const One2$outboundSchema = z.object({
    kind: z.string().default("integration"),
    resourceId: z.string(),
});
export function one2ToJSON(one2) {
    return JSON.stringify(One2$outboundSchema.parse(one2));
}
export function one2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => One2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'One2' from JSON`);
}
/** @internal */
export const One1$inboundSchema = z
    .object({
    kind: z.string().default("integration"),
    externalResourceId: z.string(),
});
/** @internal */
export const One1$outboundSchema = z.object({
    kind: z.string().default("integration"),
    externalResourceId: z.string(),
});
export function one1ToJSON(one1) {
    return JSON.stringify(One1$outboundSchema.parse(one1));
}
export function one1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => One1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'One1' from JSON`);
}
/** @internal */
export const Source1$inboundSchema = z.union([
    z.lazy(() => One1$inboundSchema),
    z.lazy(() => One2$inboundSchema),
    z.lazy(() => One3$inboundSchema),
]);
/** @internal */
export const Source1$outboundSchema = z.union([
    z.lazy(() => One1$outboundSchema),
    z.lazy(() => One2$outboundSchema),
    z.lazy(() => One3$outboundSchema),
]);
export function source1ToJSON(source1) {
    return JSON.stringify(Source1$outboundSchema.parse(source1));
}
export function source1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Source1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Source1' from JSON`);
}
/** @internal */
export const CreateDrainSource$inboundSchema = z.union([
    z.union([
        z.lazy(() => One1$inboundSchema),
        z.lazy(() => One2$inboundSchema),
        z.lazy(() => One3$inboundSchema),
    ]),
    z.lazy(() => Source2$inboundSchema),
]);
/** @internal */
export const CreateDrainSource$outboundSchema = z.union([
    z.union([
        z.lazy(() => One1$outboundSchema),
        z.lazy(() => One2$outboundSchema),
        z.lazy(() => One3$outboundSchema),
    ]),
    z.lazy(() => Source2$outboundSchema),
]);
export function createDrainSourceToJSON(createDrainSource) {
    return JSON.stringify(CreateDrainSource$outboundSchema.parse(createDrainSource));
}
export function createDrainSourceFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainSource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainSource' from JSON`);
}
/** @internal */
export const CreateDrainRequestBody$inboundSchema = z.object({
    name: z.string(),
    projects: CreateDrainProjects$inboundSchema,
    projectIds: z.array(z.string()).optional(),
    filter: z.union([z.lazy(() => Filter2$inboundSchema), z.string()]).optional(),
    schemas: z.record(z.lazy(() => Schemas$inboundSchema)),
    delivery: z.union([
        z.lazy(() => Delivery1$inboundSchema),
        z.lazy(() => Delivery2$inboundSchema),
    ]).optional(),
    sampling: z.array(z.lazy(() => Sampling$inboundSchema)).optional(),
    transforms: z.array(z.lazy(() => Transforms$inboundSchema)).optional(),
    source: z.union([
        z.union([
            z.lazy(() => One1$inboundSchema),
            z.lazy(() => One2$inboundSchema),
            z.lazy(() => One3$inboundSchema),
        ]),
        z.lazy(() => Source2$inboundSchema),
    ]).optional(),
});
/** @internal */
export const CreateDrainRequestBody$outboundSchema = z.object({
    name: z.string(),
    projects: CreateDrainProjects$outboundSchema,
    projectIds: z.array(z.string()).optional(),
    filter: z.union([z.lazy(() => Filter2$outboundSchema), z.string()])
        .optional(),
    schemas: z.record(z.lazy(() => Schemas$outboundSchema)),
    delivery: z.union([
        z.lazy(() => Delivery1$outboundSchema),
        z.lazy(() => Delivery2$outboundSchema),
    ]).optional(),
    sampling: z.array(z.lazy(() => Sampling$outboundSchema)).optional(),
    transforms: z.array(z.lazy(() => Transforms$outboundSchema)).optional(),
    source: z.union([
        z.union([
            z.lazy(() => One1$outboundSchema),
            z.lazy(() => One2$outboundSchema),
            z.lazy(() => One3$outboundSchema),
        ]),
        z.lazy(() => Source2$outboundSchema),
    ]).optional(),
});
export function createDrainRequestBodyToJSON(createDrainRequestBody) {
    return JSON.stringify(CreateDrainRequestBody$outboundSchema.parse(createDrainRequestBody));
}
export function createDrainRequestBodyFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainRequestBody' from JSON`);
}
/** @internal */
export const CreateDrainRequest$inboundSchema = z.object({
    teamId: z.string().optional(),
    slug: z.string().optional(),
    RequestBody: z.lazy(() => CreateDrainRequestBody$inboundSchema).optional(),
}).transform((v) => {
    return remap$(v, {
        "RequestBody": "requestBody",
    });
});
/** @internal */
export const CreateDrainRequest$outboundSchema = z.object({
    teamId: z.string().optional(),
    slug: z.string().optional(),
    requestBody: z.lazy(() => CreateDrainRequestBody$outboundSchema).optional(),
}).transform((v) => {
    return remap$(v, {
        requestBody: "RequestBody",
    });
});
export function createDrainRequestToJSON(createDrainRequest) {
    return JSON.stringify(CreateDrainRequest$outboundSchema.parse(createDrainRequest));
}
export function createDrainRequestFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainRequest' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyLog$inboundSchema = z.object({});
/** @internal */
export const CreateDrainResponseBodyLog$outboundSchema = z.object({});
export function createDrainResponseBodyLogToJSON(createDrainResponseBodyLog) {
    return JSON.stringify(CreateDrainResponseBodyLog$outboundSchema.parse(createDrainResponseBodyLog));
}
export function createDrainResponseBodyLogFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodyLog$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodyLog' from JSON`);
}
/** @internal */
export const ResponseBodyTrace$inboundSchema = z.object({});
/** @internal */
export const ResponseBodyTrace$outboundSchema = z.object({});
export function responseBodyTraceToJSON(responseBodyTrace) {
    return JSON.stringify(ResponseBodyTrace$outboundSchema.parse(responseBodyTrace));
}
export function responseBodyTraceFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ResponseBodyTrace$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyTrace' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyAnalytics$inboundSchema = z.object({});
/** @internal */
export const CreateDrainResponseBodyAnalytics$outboundSchema = z.object({});
export function createDrainResponseBodyAnalyticsToJSON(createDrainResponseBodyAnalytics) {
    return JSON.stringify(CreateDrainResponseBodyAnalytics$outboundSchema.parse(createDrainResponseBodyAnalytics));
}
export function createDrainResponseBodyAnalyticsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodyAnalytics$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodyAnalytics' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyDrainsSpeedInsights$inboundSchema = z.object({});
/** @internal */
export const CreateDrainResponseBodyDrainsSpeedInsights$outboundSchema = z.object({});
export function createDrainResponseBodyDrainsSpeedInsightsToJSON(createDrainResponseBodyDrainsSpeedInsights) {
    return JSON.stringify(CreateDrainResponseBodyDrainsSpeedInsights$outboundSchema.parse(createDrainResponseBodyDrainsSpeedInsights));
}
export function createDrainResponseBodyDrainsSpeedInsightsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodyDrainsSpeedInsights$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodyDrainsSpeedInsights' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodySchemas$inboundSchema = z.object({
    log: z.lazy(() => CreateDrainResponseBodyLog$inboundSchema).optional(),
    trace: z.lazy(() => ResponseBodyTrace$inboundSchema).optional(),
    analytics: z.lazy(() => CreateDrainResponseBodyAnalytics$inboundSchema)
        .optional(),
    speed_insights: z.lazy(() => CreateDrainResponseBodyDrainsSpeedInsights$inboundSchema).optional(),
}).transform((v) => {
    return remap$(v, {
        "speed_insights": "speedInsights",
    });
});
/** @internal */
export const CreateDrainResponseBodySchemas$outboundSchema = z.object({
    log: z.lazy(() => CreateDrainResponseBodyLog$outboundSchema).optional(),
    trace: z.lazy(() => ResponseBodyTrace$outboundSchema).optional(),
    analytics: z.lazy(() => CreateDrainResponseBodyAnalytics$outboundSchema)
        .optional(),
    speedInsights: z.lazy(() => CreateDrainResponseBodyDrainsSpeedInsights$outboundSchema).optional(),
}).transform((v) => {
    return remap$(v, {
        speedInsights: "speed_insights",
    });
});
export function createDrainResponseBodySchemasToJSON(createDrainResponseBodySchemas) {
    return JSON.stringify(CreateDrainResponseBodySchemas$outboundSchema.parse(createDrainResponseBodySchemas));
}
export function createDrainResponseBodySchemasFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodySchemas$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodySchemas' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBody2Type$inboundSchema = z.nativeEnum(CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBody2Type);
/** @internal */
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBody2Type$outboundSchema = CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBody2Type$inboundSchema;
/** @internal */
export const CreateDrainDeliveryTarget$inboundSchema = z.nativeEnum(CreateDrainDeliveryTarget);
/** @internal */
export const CreateDrainDeliveryTarget$outboundSchema = CreateDrainDeliveryTarget$inboundSchema;
/** @internal */
export const CreateDrainDelivery4$inboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBody2Type$inboundSchema,
    target: CreateDrainDeliveryTarget$inboundSchema,
});
/** @internal */
export const CreateDrainDelivery4$outboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBody2Type$outboundSchema,
    target: CreateDrainDeliveryTarget$outboundSchema,
});
export function createDrainDelivery4ToJSON(createDrainDelivery4) {
    return JSON.stringify(CreateDrainDelivery4$outboundSchema.parse(createDrainDelivery4));
}
export function createDrainDelivery4FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDelivery4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDelivery4' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBodyType$inboundSchema = z.nativeEnum(CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBodyType);
/** @internal */
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBodyType$outboundSchema = CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBodyType$inboundSchema;
/** @internal */
export const CreateDrainDelivery3$inboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBodyType$inboundSchema,
    endpoint: z.string(),
    table: z.string(),
});
/** @internal */
export const CreateDrainDelivery3$outboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponse200ApplicationJSONResponseBodyType$outboundSchema,
    endpoint: z.string(),
    table: z.string(),
});
export function createDrainDelivery3ToJSON(createDrainDelivery3) {
    return JSON.stringify(CreateDrainDelivery3$outboundSchema.parse(createDrainDelivery3));
}
export function createDrainDelivery3FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDelivery3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDelivery3' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONType$inboundSchema = z.nativeEnum(CreateDrainDeliveryDrainsResponse200ApplicationJSONType);
/** @internal */
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONType$outboundSchema = CreateDrainDeliveryDrainsResponse200ApplicationJSONType$inboundSchema;
/** @internal */
export const CreateDrainDeliveryEndpoint$inboundSchema = z.object({
    traces: z.string(),
});
/** @internal */
export const CreateDrainDeliveryEndpoint$outboundSchema = z.object({
    traces: z.string(),
});
export function createDrainDeliveryEndpointToJSON(createDrainDeliveryEndpoint) {
    return JSON.stringify(CreateDrainDeliveryEndpoint$outboundSchema.parse(createDrainDeliveryEndpoint));
}
export function createDrainDeliveryEndpointFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDeliveryEndpoint$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDeliveryEndpoint' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONEncoding$inboundSchema = z.nativeEnum(CreateDrainDeliveryDrainsResponse200ApplicationJSONEncoding);
/** @internal */
export const CreateDrainDeliveryDrainsResponse200ApplicationJSONEncoding$outboundSchema = CreateDrainDeliveryDrainsResponse200ApplicationJSONEncoding$inboundSchema;
/** @internal */
export const CreateDrainSecretDrainsResponseKind$inboundSchema = z.nativeEnum(CreateDrainSecretDrainsResponseKind);
/** @internal */
export const CreateDrainSecretDrainsResponseKind$outboundSchema = CreateDrainSecretDrainsResponseKind$inboundSchema;
/** @internal */
export const CreateDrainSecretDrainsResponse2$inboundSchema = z.object({
    kind: CreateDrainSecretDrainsResponseKind$inboundSchema,
});
/** @internal */
export const CreateDrainSecretDrainsResponse2$outboundSchema = z.object({
    kind: CreateDrainSecretDrainsResponseKind$outboundSchema,
});
export function createDrainSecretDrainsResponse2ToJSON(createDrainSecretDrainsResponse2) {
    return JSON.stringify(CreateDrainSecretDrainsResponse2$outboundSchema.parse(createDrainSecretDrainsResponse2));
}
export function createDrainSecretDrainsResponse2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainSecretDrainsResponse2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainSecretDrainsResponse2' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsSecret$inboundSchema = z.union([
    z.lazy(() => CreateDrainSecretDrainsResponse2$inboundSchema),
    z.string(),
]);
/** @internal */
export const CreateDrainDeliveryDrainsSecret$outboundSchema = z.union([
    z.lazy(() => CreateDrainSecretDrainsResponse2$outboundSchema),
    z.string(),
]);
export function createDrainDeliveryDrainsSecretToJSON(createDrainDeliveryDrainsSecret) {
    return JSON.stringify(CreateDrainDeliveryDrainsSecret$outboundSchema.parse(createDrainDeliveryDrainsSecret));
}
export function createDrainDeliveryDrainsSecretFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDeliveryDrainsSecret$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDeliveryDrainsSecret' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrains2$inboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponse200ApplicationJSONType$inboundSchema,
    endpoint: z.lazy(() => CreateDrainDeliveryEndpoint$inboundSchema),
    encoding: CreateDrainDeliveryDrainsResponse200ApplicationJSONEncoding$inboundSchema,
    headers: z.record(z.string()),
    secret: z.union([
        z.lazy(() => CreateDrainSecretDrainsResponse2$inboundSchema),
        z.string(),
    ]).optional(),
});
/** @internal */
export const CreateDrainDeliveryDrains2$outboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponse200ApplicationJSONType$outboundSchema,
    endpoint: z.lazy(() => CreateDrainDeliveryEndpoint$outboundSchema),
    encoding: CreateDrainDeliveryDrainsResponse200ApplicationJSONEncoding$outboundSchema,
    headers: z.record(z.string()),
    secret: z.union([
        z.lazy(() => CreateDrainSecretDrainsResponse2$outboundSchema),
        z.string(),
    ]).optional(),
});
export function createDrainDeliveryDrains2ToJSON(createDrainDeliveryDrains2) {
    return JSON.stringify(CreateDrainDeliveryDrains2$outboundSchema.parse(createDrainDeliveryDrains2));
}
export function createDrainDeliveryDrains2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDeliveryDrains2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDeliveryDrains2' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsResponse200Type$inboundSchema = z
    .nativeEnum(CreateDrainDeliveryDrainsResponse200Type);
/** @internal */
export const CreateDrainDeliveryDrainsResponse200Type$outboundSchema = CreateDrainDeliveryDrainsResponse200Type$inboundSchema;
/** @internal */
export const CreateDrainDeliveryDrainsResponse200Encoding$inboundSchema = z
    .nativeEnum(CreateDrainDeliveryDrainsResponse200Encoding);
/** @internal */
export const CreateDrainDeliveryDrainsResponse200Encoding$outboundSchema = CreateDrainDeliveryDrainsResponse200Encoding$inboundSchema;
/** @internal */
export const CreateDrainDeliveryCompression$inboundSchema = z.nativeEnum(CreateDrainDeliveryCompression);
/** @internal */
export const CreateDrainDeliveryCompression$outboundSchema = CreateDrainDeliveryCompression$inboundSchema;
/** @internal */
export const CreateDrainSecretDrainsKind$inboundSchema = z.nativeEnum(CreateDrainSecretDrainsKind);
/** @internal */
export const CreateDrainSecretDrainsKind$outboundSchema = CreateDrainSecretDrainsKind$inboundSchema;
/** @internal */
export const CreateDrainSecretDrains2$inboundSchema = z.object({
    kind: CreateDrainSecretDrainsKind$inboundSchema,
});
/** @internal */
export const CreateDrainSecretDrains2$outboundSchema = z.object({
    kind: CreateDrainSecretDrainsKind$outboundSchema,
});
export function createDrainSecretDrains2ToJSON(createDrainSecretDrains2) {
    return JSON.stringify(CreateDrainSecretDrains2$outboundSchema.parse(createDrainSecretDrains2));
}
export function createDrainSecretDrains2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainSecretDrains2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainSecretDrains2' from JSON`);
}
/** @internal */
export const CreateDrainDeliverySecret$inboundSchema = z.union([z.lazy(() => CreateDrainSecretDrains2$inboundSchema), z.string()]);
/** @internal */
export const CreateDrainDeliverySecret$outboundSchema = z.union([
    z.lazy(() => CreateDrainSecretDrains2$outboundSchema),
    z.string(),
]);
export function createDrainDeliverySecretToJSON(createDrainDeliverySecret) {
    return JSON.stringify(CreateDrainDeliverySecret$outboundSchema.parse(createDrainDeliverySecret));
}
export function createDrainDeliverySecretFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDeliverySecret$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDeliverySecret' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrains1$inboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponse200Type$inboundSchema,
    endpoint: z.string(),
    encoding: CreateDrainDeliveryDrainsResponse200Encoding$inboundSchema,
    compression: CreateDrainDeliveryCompression$inboundSchema.optional(),
    headers: z.record(z.string()),
    secret: z.union([
        z.lazy(() => CreateDrainSecretDrains2$inboundSchema),
        z.string(),
    ]).optional(),
});
/** @internal */
export const CreateDrainDeliveryDrains1$outboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponse200Type$outboundSchema,
    endpoint: z.string(),
    encoding: CreateDrainDeliveryDrainsResponse200Encoding$outboundSchema,
    compression: CreateDrainDeliveryCompression$outboundSchema.optional(),
    headers: z.record(z.string()),
    secret: z.union([
        z.lazy(() => CreateDrainSecretDrains2$outboundSchema),
        z.string(),
    ]).optional(),
});
export function createDrainDeliveryDrains1ToJSON(createDrainDeliveryDrains1) {
    return JSON.stringify(CreateDrainDeliveryDrains1$outboundSchema.parse(createDrainDeliveryDrains1));
}
export function createDrainDeliveryDrains1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDeliveryDrains1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDeliveryDrains1' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyDelivery$inboundSchema = z.union([
    z.lazy(() => CreateDrainDeliveryDrains1$inboundSchema),
    z.lazy(() => CreateDrainDeliveryDrains2$inboundSchema),
    z.lazy(() => CreateDrainDelivery3$inboundSchema),
    z.lazy(() => CreateDrainDelivery4$inboundSchema),
]);
/** @internal */
export const CreateDrainResponseBodyDelivery$outboundSchema = z.union([
    z.lazy(() => CreateDrainDeliveryDrains1$outboundSchema),
    z.lazy(() => CreateDrainDeliveryDrains2$outboundSchema),
    z.lazy(() => CreateDrainDelivery3$outboundSchema),
    z.lazy(() => CreateDrainDelivery4$outboundSchema),
]);
export function createDrainResponseBodyDeliveryToJSON(createDrainResponseBodyDelivery) {
    return JSON.stringify(CreateDrainResponseBodyDelivery$outboundSchema.parse(createDrainResponseBodyDelivery));
}
export function createDrainResponseBodyDeliveryFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodyDelivery$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodyDelivery' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyDrainsType$inboundSchema = z.nativeEnum(CreateDrainResponseBodyDrainsType);
/** @internal */
export const CreateDrainResponseBodyDrainsType$outboundSchema = CreateDrainResponseBodyDrainsType$inboundSchema;
/** @internal */
export const CreateDrainResponseBodyEnv$inboundSchema = z.nativeEnum(CreateDrainResponseBodyEnv);
/** @internal */
export const CreateDrainResponseBodyEnv$outboundSchema = CreateDrainResponseBodyEnv$inboundSchema;
/** @internal */
export const CreateDrainResponseBodySampling$inboundSchema = z.object({
    type: CreateDrainResponseBodyDrainsType$inboundSchema,
    rate: z.number(),
    env: CreateDrainResponseBodyEnv$inboundSchema.optional(),
    requestPath: z.string().optional(),
});
/** @internal */
export const CreateDrainResponseBodySampling$outboundSchema = z.object({
    type: CreateDrainResponseBodyDrainsType$outboundSchema,
    rate: z.number(),
    env: CreateDrainResponseBodyEnv$outboundSchema.optional(),
    requestPath: z.string().optional(),
});
export function createDrainResponseBodySamplingToJSON(createDrainResponseBodySampling) {
    return JSON.stringify(CreateDrainResponseBodySampling$outboundSchema.parse(createDrainResponseBodySampling));
}
export function createDrainResponseBodySamplingFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodySampling$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodySampling' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyDrainsStatus$inboundSchema = z.nativeEnum(CreateDrainResponseBodyDrainsStatus);
/** @internal */
export const CreateDrainResponseBodyDrainsStatus$outboundSchema = CreateDrainResponseBodyDrainsStatus$inboundSchema;
/** @internal */
export const ResponseBodyDisabledReason$inboundSchema = z.nativeEnum(ResponseBodyDisabledReason);
/** @internal */
export const ResponseBodyDisabledReason$outboundSchema = ResponseBodyDisabledReason$inboundSchema;
/** @internal */
export const CreateDrainSourceDrainsKind$inboundSchema = z.nativeEnum(CreateDrainSourceDrainsKind);
/** @internal */
export const CreateDrainSourceDrainsKind$outboundSchema = CreateDrainSourceDrainsKind$inboundSchema;
/** @internal */
export const CreateDrainSourceDrains2$inboundSchema = z.object({
    kind: CreateDrainSourceDrainsKind$inboundSchema,
    resourceId: z.string().optional(),
    externalResourceId: z.string().optional(),
    integrationId: z.string(),
    integrationConfigurationId: z.string(),
});
/** @internal */
export const CreateDrainSourceDrains2$outboundSchema = z.object({
    kind: CreateDrainSourceDrainsKind$outboundSchema,
    resourceId: z.string().optional(),
    externalResourceId: z.string().optional(),
    integrationId: z.string(),
    integrationConfigurationId: z.string(),
});
export function createDrainSourceDrains2ToJSON(createDrainSourceDrains2) {
    return JSON.stringify(CreateDrainSourceDrains2$outboundSchema.parse(createDrainSourceDrains2));
}
export function createDrainSourceDrains2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainSourceDrains2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainSourceDrains2' from JSON`);
}
/** @internal */
export const CreateDrainSourceKind$inboundSchema = z.nativeEnum(CreateDrainSourceKind);
/** @internal */
export const CreateDrainSourceKind$outboundSchema = CreateDrainSourceKind$inboundSchema;
/** @internal */
export const CreateDrainSourceDrains1$inboundSchema = z.object({
    kind: CreateDrainSourceKind$inboundSchema,
});
/** @internal */
export const CreateDrainSourceDrains1$outboundSchema = z.object({
    kind: CreateDrainSourceKind$outboundSchema,
});
export function createDrainSourceDrains1ToJSON(createDrainSourceDrains1) {
    return JSON.stringify(CreateDrainSourceDrains1$outboundSchema.parse(createDrainSourceDrains1));
}
export function createDrainSourceDrains1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainSourceDrains1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainSourceDrains1' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyDrainsSource$inboundSchema = z.union([
    z.lazy(() => CreateDrainSourceDrains2$inboundSchema),
    z.lazy(() => CreateDrainSourceDrains1$inboundSchema),
]);
/** @internal */
export const CreateDrainResponseBodyDrainsSource$outboundSchema = z.union([
    z.lazy(() => CreateDrainSourceDrains2$outboundSchema),
    z.lazy(() => CreateDrainSourceDrains1$outboundSchema),
]);
export function createDrainResponseBodyDrainsSourceToJSON(createDrainResponseBodyDrainsSource) {
    return JSON.stringify(CreateDrainResponseBodyDrainsSource$outboundSchema.parse(createDrainResponseBodyDrainsSource));
}
export function createDrainResponseBodyDrainsSourceFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodyDrainsSource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodyDrainsSource' from JSON`);
}
/** @internal */
export const CreateDrainFilterV2DrainsVersion$inboundSchema = z.nativeEnum(CreateDrainFilterV2DrainsVersion);
/** @internal */
export const CreateDrainFilterV2DrainsVersion$outboundSchema = CreateDrainFilterV2DrainsVersion$inboundSchema;
/** @internal */
export const CreateDrainFilterDrainsResponseType$inboundSchema = z.nativeEnum(CreateDrainFilterDrainsResponseType);
/** @internal */
export const CreateDrainFilterDrainsResponseType$outboundSchema = CreateDrainFilterDrainsResponseType$inboundSchema;
/** @internal */
export const CreateDrainFilterDrainsResponse2$inboundSchema = z.object({
    type: CreateDrainFilterDrainsResponseType$inboundSchema,
    text: z.string(),
});
/** @internal */
export const CreateDrainFilterDrainsResponse2$outboundSchema = z.object({
    type: CreateDrainFilterDrainsResponseType$outboundSchema,
    text: z.string(),
});
export function createDrainFilterDrainsResponse2ToJSON(createDrainFilterDrainsResponse2) {
    return JSON.stringify(CreateDrainFilterDrainsResponse2$outboundSchema.parse(createDrainFilterDrainsResponse2));
}
export function createDrainFilterDrainsResponse2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDrainsResponse2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDrainsResponse2' from JSON`);
}
/** @internal */
export const CreateDrainFilterDrainsType$inboundSchema = z.nativeEnum(CreateDrainFilterDrainsType);
/** @internal */
export const CreateDrainFilterDrainsType$outboundSchema = CreateDrainFilterDrainsType$inboundSchema;
/** @internal */
export const CreateDrainFilterDrainsResponseProject$inboundSchema = z.object({
    ids: z.array(z.string()).optional(),
});
/** @internal */
export const CreateDrainFilterDrainsResponseProject$outboundSchema = z.object({
    ids: z.array(z.string()).optional(),
});
export function createDrainFilterDrainsResponseProjectToJSON(createDrainFilterDrainsResponseProject) {
    return JSON.stringify(CreateDrainFilterDrainsResponseProject$outboundSchema.parse(createDrainFilterDrainsResponseProject));
}
export function createDrainFilterDrainsResponseProjectFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDrainsResponseProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDrainsResponseProject' from JSON`);
}
/** @internal */
export const CreateDrainFilterDrainsSources$inboundSchema = z.nativeEnum(CreateDrainFilterDrainsSources);
/** @internal */
export const CreateDrainFilterDrainsSources$outboundSchema = CreateDrainFilterDrainsSources$inboundSchema;
/** @internal */
export const CreateDrainFilterLog$inboundSchema = z.object({
    sources: z.array(CreateDrainFilterDrainsSources$inboundSchema).optional(),
    legacy_excludeCachedStaticAssetLogs: z.boolean().optional(),
}).transform((v) => {
    return remap$(v, {
        "legacy_excludeCachedStaticAssetLogs": "legacyExcludeCachedStaticAssetLogs",
    });
});
/** @internal */
export const CreateDrainFilterLog$outboundSchema = z.object({
    sources: z.array(CreateDrainFilterDrainsSources$outboundSchema).optional(),
    legacyExcludeCachedStaticAssetLogs: z.boolean().optional(),
}).transform((v) => {
    return remap$(v, {
        legacyExcludeCachedStaticAssetLogs: "legacy_excludeCachedStaticAssetLogs",
    });
});
export function createDrainFilterLogToJSON(createDrainFilterLog) {
    return JSON.stringify(CreateDrainFilterLog$outboundSchema.parse(createDrainFilterLog));
}
export function createDrainFilterLogFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterLog$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterLog' from JSON`);
}
/** @internal */
export const CreateDrainFilterDrainsEnvironments$inboundSchema = z.nativeEnum(CreateDrainFilterDrainsEnvironments);
/** @internal */
export const CreateDrainFilterDrainsEnvironments$outboundSchema = CreateDrainFilterDrainsEnvironments$inboundSchema;
/** @internal */
export const CreateDrainFilterDrainsResponseDeployment$inboundSchema = z.object({
    environments: z.array(CreateDrainFilterDrainsEnvironments$inboundSchema)
        .optional(),
});
/** @internal */
export const CreateDrainFilterDrainsResponseDeployment$outboundSchema = z.object({
    environments: z.array(CreateDrainFilterDrainsEnvironments$outboundSchema)
        .optional(),
});
export function createDrainFilterDrainsResponseDeploymentToJSON(createDrainFilterDrainsResponseDeployment) {
    return JSON.stringify(CreateDrainFilterDrainsResponseDeployment$outboundSchema.parse(createDrainFilterDrainsResponseDeployment));
}
export function createDrainFilterDrainsResponseDeploymentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDrainsResponseDeployment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDrainsResponseDeployment' from JSON`);
}
/** @internal */
export const CreateDrainFilterDrains1$inboundSchema = z.object({
    type: CreateDrainFilterDrainsType$inboundSchema,
    project: z.lazy(() => CreateDrainFilterDrainsResponseProject$inboundSchema)
        .optional(),
    log: z.lazy(() => CreateDrainFilterLog$inboundSchema).optional(),
    deployment: z.lazy(() => CreateDrainFilterDrainsResponseDeployment$inboundSchema).optional(),
});
/** @internal */
export const CreateDrainFilterDrains1$outboundSchema = z.object({
    type: CreateDrainFilterDrainsType$outboundSchema,
    project: z.lazy(() => CreateDrainFilterDrainsResponseProject$outboundSchema)
        .optional(),
    log: z.lazy(() => CreateDrainFilterLog$outboundSchema).optional(),
    deployment: z.lazy(() => CreateDrainFilterDrainsResponseDeployment$outboundSchema).optional(),
});
export function createDrainFilterDrains1ToJSON(createDrainFilterDrains1) {
    return JSON.stringify(CreateDrainFilterDrains1$outboundSchema.parse(createDrainFilterDrains1));
}
export function createDrainFilterDrains1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDrains1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDrains1' from JSON`);
}
/** @internal */
export const CreateDrainFilterV2Filter$inboundSchema = z.union([
    z.lazy(() => CreateDrainFilterDrainsResponse2$inboundSchema),
    z.lazy(() => CreateDrainFilterDrains1$inboundSchema),
]);
/** @internal */
export const CreateDrainFilterV2Filter$outboundSchema = z.union([
    z.lazy(() => CreateDrainFilterDrainsResponse2$outboundSchema),
    z.lazy(() => CreateDrainFilterDrains1$outboundSchema),
]);
export function createDrainFilterV2FilterToJSON(createDrainFilterV2Filter) {
    return JSON.stringify(CreateDrainFilterV2Filter$outboundSchema.parse(createDrainFilterV2Filter));
}
export function createDrainFilterV2FilterFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterV2Filter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterV2Filter' from JSON`);
}
/** @internal */
export const CreateDrainFilterV22$inboundSchema = z.object({
    version: CreateDrainFilterV2DrainsVersion$inboundSchema,
    filter: z.union([
        z.lazy(() => CreateDrainFilterDrainsResponse2$inboundSchema),
        z.lazy(() => CreateDrainFilterDrains1$inboundSchema),
    ]),
});
/** @internal */
export const CreateDrainFilterV22$outboundSchema = z.object({
    version: CreateDrainFilterV2DrainsVersion$outboundSchema,
    filter: z.union([
        z.lazy(() => CreateDrainFilterDrainsResponse2$outboundSchema),
        z.lazy(() => CreateDrainFilterDrains1$outboundSchema),
    ]),
});
export function createDrainFilterV22ToJSON(createDrainFilterV22) {
    return JSON.stringify(CreateDrainFilterV22$outboundSchema.parse(createDrainFilterV22));
}
export function createDrainFilterV22FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterV22$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterV22' from JSON`);
}
/** @internal */
export const CreateDrainFilterV2Version$inboundSchema = z.nativeEnum(CreateDrainFilterV2Version);
/** @internal */
export const CreateDrainFilterV2Version$outboundSchema = CreateDrainFilterV2Version$inboundSchema;
/** @internal */
export const CreateDrainFilterV21$inboundSchema = z.object({
    version: CreateDrainFilterV2Version$inboundSchema,
});
/** @internal */
export const CreateDrainFilterV21$outboundSchema = z.object({
    version: CreateDrainFilterV2Version$outboundSchema,
});
export function createDrainFilterV21ToJSON(createDrainFilterV21) {
    return JSON.stringify(CreateDrainFilterV21$outboundSchema.parse(createDrainFilterV21));
}
export function createDrainFilterV21FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterV21$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterV21' from JSON`);
}
/** @internal */
export const ResponseBodyFilterV2$inboundSchema = z.union([
    z.lazy(() => CreateDrainFilterV22$inboundSchema),
    z.lazy(() => CreateDrainFilterV21$inboundSchema),
]);
/** @internal */
export const ResponseBodyFilterV2$outboundSchema = z.union([
    z.lazy(() => CreateDrainFilterV22$outboundSchema),
    z.lazy(() => CreateDrainFilterV21$outboundSchema),
]);
export function responseBodyFilterV2ToJSON(responseBodyFilterV2) {
    return JSON.stringify(ResponseBodyFilterV2$outboundSchema.parse(responseBodyFilterV2));
}
export function responseBodyFilterV2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => ResponseBodyFilterV2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyFilterV2' from JSON`);
}
/** @internal */
export const ProjectAccessAccess$inboundSchema = z.nativeEnum(ProjectAccessAccess);
/** @internal */
export const ProjectAccessAccess$outboundSchema = ProjectAccessAccess$inboundSchema;
/** @internal */
export const ProjectAccess2$inboundSchema = z.object({
    access: ProjectAccessAccess$inboundSchema,
    projectIds: z.array(z.string()),
});
/** @internal */
export const ProjectAccess2$outboundSchema = z.object({
    access: ProjectAccessAccess$outboundSchema,
    projectIds: z.array(z.string()),
});
export function projectAccess2ToJSON(projectAccess2) {
    return JSON.stringify(ProjectAccess2$outboundSchema.parse(projectAccess2));
}
export function projectAccess2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => ProjectAccess2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProjectAccess2' from JSON`);
}
/** @internal */
export const CreateDrainProjectAccessAccess$inboundSchema = z.nativeEnum(CreateDrainProjectAccessAccess);
/** @internal */
export const CreateDrainProjectAccessAccess$outboundSchema = CreateDrainProjectAccessAccess$inboundSchema;
/** @internal */
export const ProjectAccess1$inboundSchema = z.object({
    access: CreateDrainProjectAccessAccess$inboundSchema,
});
/** @internal */
export const ProjectAccess1$outboundSchema = z.object({
    access: CreateDrainProjectAccessAccess$outboundSchema,
});
export function projectAccess1ToJSON(projectAccess1) {
    return JSON.stringify(ProjectAccess1$outboundSchema.parse(projectAccess1));
}
export function projectAccess1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => ProjectAccess1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProjectAccess1' from JSON`);
}
/** @internal */
export const ProjectAccess$inboundSchema = z.union([
    z.lazy(() => ProjectAccess2$inboundSchema),
    z.lazy(() => ProjectAccess1$inboundSchema),
]);
/** @internal */
export const ProjectAccess$outboundSchema = z.union([
    z.lazy(() => ProjectAccess2$outboundSchema),
    z.lazy(() => ProjectAccess1$outboundSchema),
]);
export function projectAccessToJSON(projectAccess) {
    return JSON.stringify(ProjectAccess$outboundSchema.parse(projectAccess));
}
export function projectAccessFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ProjectAccess$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProjectAccess' from JSON`);
}
/** @internal */
export const CreateDrainResponseBody2$inboundSchema = z.object({
    id: z.string(),
    ownerId: z.string(),
    name: z.string(),
    createdAt: z.number(),
    updatedAt: z.number(),
    projectIds: z.array(z.string()).optional(),
    schemas: z.lazy(() => CreateDrainResponseBodySchemas$inboundSchema)
        .optional(),
    delivery: z.union([
        z.lazy(() => CreateDrainDeliveryDrains1$inboundSchema),
        z.lazy(() => CreateDrainDeliveryDrains2$inboundSchema),
        z.lazy(() => CreateDrainDelivery3$inboundSchema),
        z.lazy(() => CreateDrainDelivery4$inboundSchema),
    ]).optional(),
    sampling: z.array(z.lazy(() => CreateDrainResponseBodySampling$inboundSchema))
        .optional(),
    teamId: z.nullable(z.string()).optional(),
    status: CreateDrainResponseBodyDrainsStatus$inboundSchema.optional(),
    disabledAt: z.number().optional(),
    disabledReason: ResponseBodyDisabledReason$inboundSchema.optional(),
    disabledBy: z.string().optional(),
    firstErrorTimestamp: z.number().optional(),
    source: z.union([
        z.lazy(() => CreateDrainSourceDrains2$inboundSchema),
        z.lazy(() => CreateDrainSourceDrains1$inboundSchema),
    ]),
    filter: z.string().optional(),
    filterV2: z.union([
        z.lazy(() => CreateDrainFilterV22$inboundSchema),
        z.lazy(() => CreateDrainFilterV21$inboundSchema),
    ]).optional(),
    integrationIcon: z.string().optional(),
    integrationConfigurationUri: z.string().optional(),
    integrationWebsite: z.string().optional(),
    projectAccess: z.union([
        z.lazy(() => ProjectAccess2$inboundSchema),
        z.lazy(() => ProjectAccess1$inboundSchema),
    ]).optional(),
});
/** @internal */
export const CreateDrainResponseBody2$outboundSchema = z.object({
    id: z.string(),
    ownerId: z.string(),
    name: z.string(),
    createdAt: z.number(),
    updatedAt: z.number(),
    projectIds: z.array(z.string()).optional(),
    schemas: z.lazy(() => CreateDrainResponseBodySchemas$outboundSchema)
        .optional(),
    delivery: z.union([
        z.lazy(() => CreateDrainDeliveryDrains1$outboundSchema),
        z.lazy(() => CreateDrainDeliveryDrains2$outboundSchema),
        z.lazy(() => CreateDrainDelivery3$outboundSchema),
        z.lazy(() => CreateDrainDelivery4$outboundSchema),
    ]).optional(),
    sampling: z.array(z.lazy(() => CreateDrainResponseBodySampling$outboundSchema)).optional(),
    teamId: z.nullable(z.string()).optional(),
    status: CreateDrainResponseBodyDrainsStatus$outboundSchema.optional(),
    disabledAt: z.number().optional(),
    disabledReason: ResponseBodyDisabledReason$outboundSchema.optional(),
    disabledBy: z.string().optional(),
    firstErrorTimestamp: z.number().optional(),
    source: z.union([
        z.lazy(() => CreateDrainSourceDrains2$outboundSchema),
        z.lazy(() => CreateDrainSourceDrains1$outboundSchema),
    ]),
    filter: z.string().optional(),
    filterV2: z.union([
        z.lazy(() => CreateDrainFilterV22$outboundSchema),
        z.lazy(() => CreateDrainFilterV21$outboundSchema),
    ]).optional(),
    integrationIcon: z.string().optional(),
    integrationConfigurationUri: z.string().optional(),
    integrationWebsite: z.string().optional(),
    projectAccess: z.union([
        z.lazy(() => ProjectAccess2$outboundSchema),
        z.lazy(() => ProjectAccess1$outboundSchema),
    ]).optional(),
});
export function createDrainResponseBody2ToJSON(createDrainResponseBody2) {
    return JSON.stringify(CreateDrainResponseBody2$outboundSchema.parse(createDrainResponseBody2));
}
export function createDrainResponseBody2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBody2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBody2' from JSON`);
}
/** @internal */
export const ResponseBodyLog$inboundSchema = z.object({});
/** @internal */
export const ResponseBodyLog$outboundSchema = z.object({});
export function responseBodyLogToJSON(responseBodyLog) {
    return JSON.stringify(ResponseBodyLog$outboundSchema.parse(responseBodyLog));
}
export function responseBodyLogFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ResponseBodyLog$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyLog' from JSON`);
}
/** @internal */
export const Trace$inboundSchema = z
    .object({});
/** @internal */
export const Trace$outboundSchema = z.object({});
export function traceToJSON(trace) {
    return JSON.stringify(Trace$outboundSchema.parse(trace));
}
export function traceFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Trace$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Trace' from JSON`);
}
/** @internal */
export const ResponseBodyAnalytics$inboundSchema = z.object({});
/** @internal */
export const ResponseBodyAnalytics$outboundSchema = z.object({});
export function responseBodyAnalyticsToJSON(responseBodyAnalytics) {
    return JSON.stringify(ResponseBodyAnalytics$outboundSchema.parse(responseBodyAnalytics));
}
export function responseBodyAnalyticsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ResponseBodyAnalytics$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyAnalytics' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodySpeedInsights$inboundSchema = z.object({});
/** @internal */
export const CreateDrainResponseBodySpeedInsights$outboundSchema = z.object({});
export function createDrainResponseBodySpeedInsightsToJSON(createDrainResponseBodySpeedInsights) {
    return JSON.stringify(CreateDrainResponseBodySpeedInsights$outboundSchema.parse(createDrainResponseBodySpeedInsights));
}
export function createDrainResponseBodySpeedInsightsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodySpeedInsights$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodySpeedInsights' from JSON`);
}
/** @internal */
export const ResponseBodySchemas$inboundSchema = z.object({
    log: z.lazy(() => ResponseBodyLog$inboundSchema).optional(),
    trace: z.lazy(() => Trace$inboundSchema).optional(),
    analytics: z.lazy(() => ResponseBodyAnalytics$inboundSchema).optional(),
    speed_insights: z.lazy(() => CreateDrainResponseBodySpeedInsights$inboundSchema).optional(),
}).transform((v) => {
    return remap$(v, {
        "speed_insights": "speedInsights",
    });
});
/** @internal */
export const ResponseBodySchemas$outboundSchema = z.object({
    log: z.lazy(() => ResponseBodyLog$outboundSchema).optional(),
    trace: z.lazy(() => Trace$outboundSchema).optional(),
    analytics: z.lazy(() => ResponseBodyAnalytics$outboundSchema).optional(),
    speedInsights: z.lazy(() => CreateDrainResponseBodySpeedInsights$outboundSchema).optional(),
}).transform((v) => {
    return remap$(v, {
        speedInsights: "speed_insights",
    });
});
export function responseBodySchemasToJSON(responseBodySchemas) {
    return JSON.stringify(ResponseBodySchemas$outboundSchema.parse(responseBodySchemas));
}
export function responseBodySchemasFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ResponseBodySchemas$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodySchemas' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsResponseType$inboundSchema = z.nativeEnum(CreateDrainDeliveryDrainsResponseType);
/** @internal */
export const CreateDrainDeliveryDrainsResponseType$outboundSchema = CreateDrainDeliveryDrainsResponseType$inboundSchema;
/** @internal */
export const DeliveryTarget$inboundSchema = z.nativeEnum(DeliveryTarget);
/** @internal */
export const DeliveryTarget$outboundSchema = DeliveryTarget$inboundSchema;
/** @internal */
export const Delivery4$inboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponseType$inboundSchema,
    target: DeliveryTarget$inboundSchema,
});
/** @internal */
export const Delivery4$outboundSchema = z.object({
    type: CreateDrainDeliveryDrainsResponseType$outboundSchema,
    target: DeliveryTarget$outboundSchema,
});
export function delivery4ToJSON(delivery4) {
    return JSON.stringify(Delivery4$outboundSchema.parse(delivery4));
}
export function delivery4FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Delivery4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Delivery4' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsType$inboundSchema = z.nativeEnum(CreateDrainDeliveryDrainsType);
/** @internal */
export const CreateDrainDeliveryDrainsType$outboundSchema = CreateDrainDeliveryDrainsType$inboundSchema;
/** @internal */
export const Delivery3$inboundSchema = z.object({
    type: CreateDrainDeliveryDrainsType$inboundSchema,
    endpoint: z.string(),
    table: z.string(),
});
/** @internal */
export const Delivery3$outboundSchema = z.object({
    type: CreateDrainDeliveryDrainsType$outboundSchema,
    endpoint: z.string(),
    table: z.string(),
});
export function delivery3ToJSON(delivery3) {
    return JSON.stringify(Delivery3$outboundSchema.parse(delivery3));
}
export function delivery3FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Delivery3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Delivery3' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryType$inboundSchema = z.nativeEnum(CreateDrainDeliveryType);
/** @internal */
export const CreateDrainDeliveryType$outboundSchema = CreateDrainDeliveryType$inboundSchema;
/** @internal */
export const CreateDrainDeliveryDrainsEndpoint$inboundSchema = z.object({
    traces: z.string(),
});
/** @internal */
export const CreateDrainDeliveryDrainsEndpoint$outboundSchema = z.object({
    traces: z.string(),
});
export function createDrainDeliveryDrainsEndpointToJSON(createDrainDeliveryDrainsEndpoint) {
    return JSON.stringify(CreateDrainDeliveryDrainsEndpoint$outboundSchema.parse(createDrainDeliveryDrainsEndpoint));
}
export function createDrainDeliveryDrainsEndpointFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDeliveryDrainsEndpoint$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDeliveryDrainsEndpoint' from JSON`);
}
/** @internal */
export const CreateDrainDeliveryDrainsResponseEncoding$inboundSchema = z
    .nativeEnum(CreateDrainDeliveryDrainsResponseEncoding);
/** @internal */
export const CreateDrainDeliveryDrainsResponseEncoding$outboundSchema = CreateDrainDeliveryDrainsResponseEncoding$inboundSchema;
/** @internal */
export const CreateDrainSecretKind$inboundSchema = z.nativeEnum(CreateDrainSecretKind);
/** @internal */
export const CreateDrainSecretKind$outboundSchema = CreateDrainSecretKind$inboundSchema;
/** @internal */
export const CreateDrainSecret2$inboundSchema = z.object({
    kind: CreateDrainSecretKind$inboundSchema,
});
/** @internal */
export const CreateDrainSecret2$outboundSchema = z.object({
    kind: CreateDrainSecretKind$outboundSchema,
});
export function createDrainSecret2ToJSON(createDrainSecret2) {
    return JSON.stringify(CreateDrainSecret2$outboundSchema.parse(createDrainSecret2));
}
export function createDrainSecret2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainSecret2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainSecret2' from JSON`);
}
/** @internal */
export const DeliverySecret$inboundSchema = z.union([z.lazy(() => CreateDrainSecret2$inboundSchema), z.string()]);
/** @internal */
export const DeliverySecret$outboundSchema = z.union([z.lazy(() => CreateDrainSecret2$outboundSchema), z.string()]);
export function deliverySecretToJSON(deliverySecret) {
    return JSON.stringify(DeliverySecret$outboundSchema.parse(deliverySecret));
}
export function deliverySecretFromJSON(jsonString) {
    return safeParse(jsonString, (x) => DeliverySecret$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeliverySecret' from JSON`);
}
/** @internal */
export const CreateDrainDelivery2$inboundSchema = z.object({
    type: CreateDrainDeliveryType$inboundSchema,
    endpoint: z.lazy(() => CreateDrainDeliveryDrainsEndpoint$inboundSchema),
    encoding: CreateDrainDeliveryDrainsResponseEncoding$inboundSchema,
    headers: z.record(z.string()),
    secret: z.union([z.lazy(() => CreateDrainSecret2$inboundSchema), z.string()])
        .optional(),
});
/** @internal */
export const CreateDrainDelivery2$outboundSchema = z.object({
    type: CreateDrainDeliveryType$outboundSchema,
    endpoint: z.lazy(() => CreateDrainDeliveryDrainsEndpoint$outboundSchema),
    encoding: CreateDrainDeliveryDrainsResponseEncoding$outboundSchema,
    headers: z.record(z.string()),
    secret: z.union([z.lazy(() => CreateDrainSecret2$outboundSchema), z.string()])
        .optional(),
});
export function createDrainDelivery2ToJSON(createDrainDelivery2) {
    return JSON.stringify(CreateDrainDelivery2$outboundSchema.parse(createDrainDelivery2));
}
export function createDrainDelivery2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDelivery2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDelivery2' from JSON`);
}
/** @internal */
export const DeliveryType$inboundSchema = z.nativeEnum(DeliveryType);
/** @internal */
export const DeliveryType$outboundSchema = DeliveryType$inboundSchema;
/** @internal */
export const CreateDrainDeliveryDrainsEncoding$inboundSchema = z.nativeEnum(CreateDrainDeliveryDrainsEncoding);
/** @internal */
export const CreateDrainDeliveryDrainsEncoding$outboundSchema = CreateDrainDeliveryDrainsEncoding$inboundSchema;
/** @internal */
export const CreateDrainDeliveryDrainsCompression$inboundSchema = z.nativeEnum(CreateDrainDeliveryDrainsCompression);
/** @internal */
export const CreateDrainDeliveryDrainsCompression$outboundSchema = CreateDrainDeliveryDrainsCompression$inboundSchema;
/** @internal */
export const SecretKind$inboundSchema = z
    .nativeEnum(SecretKind);
/** @internal */
export const SecretKind$outboundSchema = SecretKind$inboundSchema;
/** @internal */
export const Secret2$inboundSchema = z.object({
    kind: SecretKind$inboundSchema,
});
/** @internal */
export const Secret2$outboundSchema = z.object({
    kind: SecretKind$outboundSchema,
});
export function secret2ToJSON(secret2) {
    return JSON.stringify(Secret2$outboundSchema.parse(secret2));
}
export function secret2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => Secret2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Secret2' from JSON`);
}
/** @internal */
export const Secret$inboundSchema = z
    .union([z.lazy(() => Secret2$inboundSchema), z.string()]);
/** @internal */
export const Secret$outboundSchema = z.union([z.lazy(() => Secret2$outboundSchema), z.string()]);
export function secretToJSON(secret) {
    return JSON.stringify(Secret$outboundSchema.parse(secret));
}
export function secretFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Secret$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Secret' from JSON`);
}
/** @internal */
export const CreateDrainDelivery1$inboundSchema = z.object({
    type: DeliveryType$inboundSchema,
    endpoint: z.string(),
    encoding: CreateDrainDeliveryDrainsEncoding$inboundSchema,
    compression: CreateDrainDeliveryDrainsCompression$inboundSchema.optional(),
    headers: z.record(z.string()),
    secret: z.union([z.lazy(() => Secret2$inboundSchema), z.string()]).optional(),
});
/** @internal */
export const CreateDrainDelivery1$outboundSchema = z.object({
    type: DeliveryType$outboundSchema,
    endpoint: z.string(),
    encoding: CreateDrainDeliveryDrainsEncoding$outboundSchema,
    compression: CreateDrainDeliveryDrainsCompression$outboundSchema.optional(),
    headers: z.record(z.string()),
    secret: z.union([z.lazy(() => Secret2$outboundSchema), z.string()])
        .optional(),
});
export function createDrainDelivery1ToJSON(createDrainDelivery1) {
    return JSON.stringify(CreateDrainDelivery1$outboundSchema.parse(createDrainDelivery1));
}
export function createDrainDelivery1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainDelivery1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainDelivery1' from JSON`);
}
/** @internal */
export const ResponseBodyDelivery$inboundSchema = z.union([
    z.lazy(() => CreateDrainDelivery1$inboundSchema),
    z.lazy(() => CreateDrainDelivery2$inboundSchema),
    z.lazy(() => Delivery3$inboundSchema),
    z.lazy(() => Delivery4$inboundSchema),
]);
/** @internal */
export const ResponseBodyDelivery$outboundSchema = z.union([
    z.lazy(() => CreateDrainDelivery1$outboundSchema),
    z.lazy(() => CreateDrainDelivery2$outboundSchema),
    z.lazy(() => Delivery3$outboundSchema),
    z.lazy(() => Delivery4$outboundSchema),
]);
export function responseBodyDeliveryToJSON(responseBodyDelivery) {
    return JSON.stringify(ResponseBodyDelivery$outboundSchema.parse(responseBodyDelivery));
}
export function responseBodyDeliveryFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ResponseBodyDelivery$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyDelivery' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyType$inboundSchema = z.nativeEnum(CreateDrainResponseBodyType);
/** @internal */
export const CreateDrainResponseBodyType$outboundSchema = CreateDrainResponseBodyType$inboundSchema;
/** @internal */
export const ResponseBodyEnv$inboundSchema = z.nativeEnum(ResponseBodyEnv);
/** @internal */
export const ResponseBodyEnv$outboundSchema = ResponseBodyEnv$inboundSchema;
/** @internal */
export const ResponseBodySampling$inboundSchema = z.object({
    type: CreateDrainResponseBodyType$inboundSchema,
    rate: z.number(),
    env: ResponseBodyEnv$inboundSchema.optional(),
    requestPath: z.string().optional(),
});
/** @internal */
export const ResponseBodySampling$outboundSchema = z.object({
    type: CreateDrainResponseBodyType$outboundSchema,
    rate: z.number(),
    env: ResponseBodyEnv$outboundSchema.optional(),
    requestPath: z.string().optional(),
});
export function responseBodySamplingToJSON(responseBodySampling) {
    return JSON.stringify(ResponseBodySampling$outboundSchema.parse(responseBodySampling));
}
export function responseBodySamplingFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ResponseBodySampling$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodySampling' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodyStatus$inboundSchema = z.nativeEnum(CreateDrainResponseBodyStatus);
/** @internal */
export const CreateDrainResponseBodyStatus$outboundSchema = CreateDrainResponseBodyStatus$inboundSchema;
/** @internal */
export const DisabledReason$inboundSchema = z.nativeEnum(DisabledReason);
/** @internal */
export const DisabledReason$outboundSchema = DisabledReason$inboundSchema;
/** @internal */
export const CreateDrainSourceDrainsResponse200Kind$inboundSchema = z.nativeEnum(CreateDrainSourceDrainsResponse200Kind);
/** @internal */
export const CreateDrainSourceDrainsResponse200Kind$outboundSchema = CreateDrainSourceDrainsResponse200Kind$inboundSchema;
/** @internal */
export const CreateDrainSource2$inboundSchema = z.object({
    kind: CreateDrainSourceDrainsResponse200Kind$inboundSchema,
    resourceId: z.string().optional(),
    externalResourceId: z.string().optional(),
    integrationId: z.string(),
    integrationConfigurationId: z.string(),
});
/** @internal */
export const CreateDrainSource2$outboundSchema = z.object({
    kind: CreateDrainSourceDrainsResponse200Kind$outboundSchema,
    resourceId: z.string().optional(),
    externalResourceId: z.string().optional(),
    integrationId: z.string(),
    integrationConfigurationId: z.string(),
});
export function createDrainSource2ToJSON(createDrainSource2) {
    return JSON.stringify(CreateDrainSource2$outboundSchema.parse(createDrainSource2));
}
export function createDrainSource2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainSource2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainSource2' from JSON`);
}
/** @internal */
export const CreateDrainSourceDrainsResponseKind$inboundSchema = z.nativeEnum(CreateDrainSourceDrainsResponseKind);
/** @internal */
export const CreateDrainSourceDrainsResponseKind$outboundSchema = CreateDrainSourceDrainsResponseKind$inboundSchema;
/** @internal */
export const CreateDrainSource1$inboundSchema = z.object({
    kind: CreateDrainSourceDrainsResponseKind$inboundSchema,
});
/** @internal */
export const CreateDrainSource1$outboundSchema = z.object({
    kind: CreateDrainSourceDrainsResponseKind$outboundSchema,
});
export function createDrainSource1ToJSON(createDrainSource1) {
    return JSON.stringify(CreateDrainSource1$outboundSchema.parse(createDrainSource1));
}
export function createDrainSource1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainSource1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainSource1' from JSON`);
}
/** @internal */
export const CreateDrainResponseBodySource$inboundSchema = z.union([
    z.lazy(() => CreateDrainSource2$inboundSchema),
    z.lazy(() => CreateDrainSource1$inboundSchema),
]);
/** @internal */
export const CreateDrainResponseBodySource$outboundSchema = z.union([
    z.lazy(() => CreateDrainSource2$outboundSchema),
    z.lazy(() => CreateDrainSource1$outboundSchema),
]);
export function createDrainResponseBodySourceToJSON(createDrainResponseBodySource) {
    return JSON.stringify(CreateDrainResponseBodySource$outboundSchema.parse(createDrainResponseBodySource));
}
export function createDrainResponseBodySourceFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBodySource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBodySource' from JSON`);
}
/** @internal */
export const FilterV2Version$inboundSchema = z.nativeEnum(FilterV2Version);
/** @internal */
export const FilterV2Version$outboundSchema = FilterV2Version$inboundSchema;
/** @internal */
export const CreateDrainFilterType$inboundSchema = z.nativeEnum(CreateDrainFilterType);
/** @internal */
export const CreateDrainFilterType$outboundSchema = CreateDrainFilterType$inboundSchema;
/** @internal */
export const CreateDrainFilterDrains2$inboundSchema = z.object({
    type: CreateDrainFilterType$inboundSchema,
    text: z.string(),
});
/** @internal */
export const CreateDrainFilterDrains2$outboundSchema = z.object({
    type: CreateDrainFilterType$outboundSchema,
    text: z.string(),
});
export function createDrainFilterDrains2ToJSON(createDrainFilterDrains2) {
    return JSON.stringify(CreateDrainFilterDrains2$outboundSchema.parse(createDrainFilterDrains2));
}
export function createDrainFilterDrains2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDrains2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDrains2' from JSON`);
}
/** @internal */
export const FilterType$inboundSchema = z
    .nativeEnum(FilterType);
/** @internal */
export const FilterType$outboundSchema = FilterType$inboundSchema;
/** @internal */
export const CreateDrainFilterDrainsProject$inboundSchema = z.object({
    ids: z.array(z.string()).optional(),
});
/** @internal */
export const CreateDrainFilterDrainsProject$outboundSchema = z.object({
    ids: z.array(z.string()).optional(),
});
export function createDrainFilterDrainsProjectToJSON(createDrainFilterDrainsProject) {
    return JSON.stringify(CreateDrainFilterDrainsProject$outboundSchema.parse(createDrainFilterDrainsProject));
}
export function createDrainFilterDrainsProjectFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDrainsProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDrainsProject' from JSON`);
}
/** @internal */
export const CreateDrainFilterSources$inboundSchema = z.nativeEnum(CreateDrainFilterSources);
/** @internal */
export const CreateDrainFilterSources$outboundSchema = CreateDrainFilterSources$inboundSchema;
/** @internal */
export const CreateDrainFilterDrainsLog$inboundSchema = z.object({
    sources: z.array(CreateDrainFilterSources$inboundSchema).optional(),
    legacy_excludeCachedStaticAssetLogs: z.boolean().optional(),
}).transform((v) => {
    return remap$(v, {
        "legacy_excludeCachedStaticAssetLogs": "legacyExcludeCachedStaticAssetLogs",
    });
});
/** @internal */
export const CreateDrainFilterDrainsLog$outboundSchema = z.object({
    sources: z.array(CreateDrainFilterSources$outboundSchema).optional(),
    legacyExcludeCachedStaticAssetLogs: z.boolean().optional(),
}).transform((v) => {
    return remap$(v, {
        legacyExcludeCachedStaticAssetLogs: "legacy_excludeCachedStaticAssetLogs",
    });
});
export function createDrainFilterDrainsLogToJSON(createDrainFilterDrainsLog) {
    return JSON.stringify(CreateDrainFilterDrainsLog$outboundSchema.parse(createDrainFilterDrainsLog));
}
export function createDrainFilterDrainsLogFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDrainsLog$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDrainsLog' from JSON`);
}
/** @internal */
export const CreateDrainFilterEnvironments$inboundSchema = z.nativeEnum(CreateDrainFilterEnvironments);
/** @internal */
export const CreateDrainFilterEnvironments$outboundSchema = CreateDrainFilterEnvironments$inboundSchema;
/** @internal */
export const CreateDrainFilterDrainsDeployment$inboundSchema = z.object({
    environments: z.array(CreateDrainFilterEnvironments$inboundSchema).optional(),
});
/** @internal */
export const CreateDrainFilterDrainsDeployment$outboundSchema = z.object({
    environments: z.array(CreateDrainFilterEnvironments$outboundSchema)
        .optional(),
});
export function createDrainFilterDrainsDeploymentToJSON(createDrainFilterDrainsDeployment) {
    return JSON.stringify(CreateDrainFilterDrainsDeployment$outboundSchema.parse(createDrainFilterDrainsDeployment));
}
export function createDrainFilterDrainsDeploymentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilterDrainsDeployment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilterDrainsDeployment' from JSON`);
}
/** @internal */
export const CreateDrainFilter1$inboundSchema = z.object({
    type: FilterType$inboundSchema,
    project: z.lazy(() => CreateDrainFilterDrainsProject$inboundSchema)
        .optional(),
    log: z.lazy(() => CreateDrainFilterDrainsLog$inboundSchema).optional(),
    deployment: z.lazy(() => CreateDrainFilterDrainsDeployment$inboundSchema)
        .optional(),
});
/** @internal */
export const CreateDrainFilter1$outboundSchema = z.object({
    type: FilterType$outboundSchema,
    project: z.lazy(() => CreateDrainFilterDrainsProject$outboundSchema)
        .optional(),
    log: z.lazy(() => CreateDrainFilterDrainsLog$outboundSchema).optional(),
    deployment: z.lazy(() => CreateDrainFilterDrainsDeployment$outboundSchema)
        .optional(),
});
export function createDrainFilter1ToJSON(createDrainFilter1) {
    return JSON.stringify(CreateDrainFilter1$outboundSchema.parse(createDrainFilter1));
}
export function createDrainFilter1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainFilter1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainFilter1' from JSON`);
}
/** @internal */
export const FilterV2Filter$inboundSchema = z.union([
    z.lazy(() => CreateDrainFilterDrains2$inboundSchema),
    z.lazy(() => CreateDrainFilter1$inboundSchema),
]);
/** @internal */
export const FilterV2Filter$outboundSchema = z.union([
    z.lazy(() => CreateDrainFilterDrains2$outboundSchema),
    z.lazy(() => CreateDrainFilter1$outboundSchema),
]);
export function filterV2FilterToJSON(filterV2Filter) {
    return JSON.stringify(FilterV2Filter$outboundSchema.parse(filterV2Filter));
}
export function filterV2FilterFromJSON(jsonString) {
    return safeParse(jsonString, (x) => FilterV2Filter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilterV2Filter' from JSON`);
}
/** @internal */
export const FilterV22$inboundSchema = z.object({
    version: FilterV2Version$inboundSchema,
    filter: z.union([
        z.lazy(() => CreateDrainFilterDrains2$inboundSchema),
        z.lazy(() => CreateDrainFilter1$inboundSchema),
    ]),
});
/** @internal */
export const FilterV22$outboundSchema = z.object({
    version: FilterV2Version$outboundSchema,
    filter: z.union([
        z.lazy(() => CreateDrainFilterDrains2$outboundSchema),
        z.lazy(() => CreateDrainFilter1$outboundSchema),
    ]),
});
export function filterV22ToJSON(filterV22) {
    return JSON.stringify(FilterV22$outboundSchema.parse(filterV22));
}
export function filterV22FromJSON(jsonString) {
    return safeParse(jsonString, (x) => FilterV22$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilterV22' from JSON`);
}
/** @internal */
export const CreateDrainFilterV2DrainsResponseVersion$inboundSchema = z
    .nativeEnum(CreateDrainFilterV2DrainsResponseVersion);
/** @internal */
export const CreateDrainFilterV2DrainsResponseVersion$outboundSchema = CreateDrainFilterV2DrainsResponseVersion$inboundSchema;
/** @internal */
export const FilterV21$inboundSchema = z.object({
    version: CreateDrainFilterV2DrainsResponseVersion$inboundSchema,
});
/** @internal */
export const FilterV21$outboundSchema = z.object({
    version: CreateDrainFilterV2DrainsResponseVersion$outboundSchema,
});
export function filterV21ToJSON(filterV21) {
    return JSON.stringify(FilterV21$outboundSchema.parse(filterV21));
}
export function filterV21FromJSON(jsonString) {
    return safeParse(jsonString, (x) => FilterV21$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilterV21' from JSON`);
}
/** @internal */
export const FilterV2$inboundSchema = z.union([
    z.lazy(() => FilterV22$inboundSchema),
    z.lazy(() => FilterV21$inboundSchema),
]);
/** @internal */
export const FilterV2$outboundSchema = z.union([
    z.lazy(() => FilterV22$outboundSchema),
    z.lazy(() => FilterV21$outboundSchema),
]);
export function filterV2ToJSON(filterV2) {
    return JSON.stringify(FilterV2$outboundSchema.parse(filterV2));
}
export function filterV2FromJSON(jsonString) {
    return safeParse(jsonString, (x) => FilterV2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilterV2' from JSON`);
}
/** @internal */
export const CreateDrainResponseBody1$inboundSchema = z.object({
    id: z.string(),
    ownerId: z.string(),
    name: z.string(),
    createdAt: z.number(),
    updatedAt: z.number(),
    projectIds: z.array(z.string()).optional(),
    schemas: z.lazy(() => ResponseBodySchemas$inboundSchema).optional(),
    delivery: z.union([
        z.lazy(() => CreateDrainDelivery1$inboundSchema),
        z.lazy(() => CreateDrainDelivery2$inboundSchema),
        z.lazy(() => Delivery3$inboundSchema),
        z.lazy(() => Delivery4$inboundSchema),
    ]).optional(),
    sampling: z.array(z.lazy(() => ResponseBodySampling$inboundSchema))
        .optional(),
    teamId: z.nullable(z.string()).optional(),
    status: CreateDrainResponseBodyStatus$inboundSchema.optional(),
    disabledAt: z.number().optional(),
    disabledReason: DisabledReason$inboundSchema.optional(),
    disabledBy: z.string().optional(),
    firstErrorTimestamp: z.number().optional(),
    source: z.union([
        z.lazy(() => CreateDrainSource2$inboundSchema),
        z.lazy(() => CreateDrainSource1$inboundSchema),
    ]),
    filter: z.string().optional(),
    filterV2: z.union([
        z.lazy(() => FilterV22$inboundSchema),
        z.lazy(() => FilterV21$inboundSchema),
    ]).optional(),
});
/** @internal */
export const CreateDrainResponseBody1$outboundSchema = z.object({
    id: z.string(),
    ownerId: z.string(),
    name: z.string(),
    createdAt: z.number(),
    updatedAt: z.number(),
    projectIds: z.array(z.string()).optional(),
    schemas: z.lazy(() => ResponseBodySchemas$outboundSchema).optional(),
    delivery: z.union([
        z.lazy(() => CreateDrainDelivery1$outboundSchema),
        z.lazy(() => CreateDrainDelivery2$outboundSchema),
        z.lazy(() => Delivery3$outboundSchema),
        z.lazy(() => Delivery4$outboundSchema),
    ]).optional(),
    sampling: z.array(z.lazy(() => ResponseBodySampling$outboundSchema))
        .optional(),
    teamId: z.nullable(z.string()).optional(),
    status: CreateDrainResponseBodyStatus$outboundSchema.optional(),
    disabledAt: z.number().optional(),
    disabledReason: DisabledReason$outboundSchema.optional(),
    disabledBy: z.string().optional(),
    firstErrorTimestamp: z.number().optional(),
    source: z.union([
        z.lazy(() => CreateDrainSource2$outboundSchema),
        z.lazy(() => CreateDrainSource1$outboundSchema),
    ]),
    filter: z.string().optional(),
    filterV2: z.union([
        z.lazy(() => FilterV22$outboundSchema),
        z.lazy(() => FilterV21$outboundSchema),
    ]).optional(),
});
export function createDrainResponseBody1ToJSON(createDrainResponseBody1) {
    return JSON.stringify(CreateDrainResponseBody1$outboundSchema.parse(createDrainResponseBody1));
}
export function createDrainResponseBody1FromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBody1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBody1' from JSON`);
}
/** @internal */
export const CreateDrainResponseBody$inboundSchema = z.union([
    z.lazy(() => CreateDrainResponseBody1$inboundSchema),
    z.lazy(() => CreateDrainResponseBody2$inboundSchema),
]);
/** @internal */
export const CreateDrainResponseBody$outboundSchema = z.union([
    z.lazy(() => CreateDrainResponseBody1$outboundSchema),
    z.lazy(() => CreateDrainResponseBody2$outboundSchema),
]);
export function createDrainResponseBodyToJSON(createDrainResponseBody) {
    return JSON.stringify(CreateDrainResponseBody$outboundSchema.parse(createDrainResponseBody));
}
export function createDrainResponseBodyFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateDrainResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateDrainResponseBody' from JSON`);
}
//# sourceMappingURL=createdrainop.js.map