/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
export const SearchParametersType = {
    Bytes: "bytes",
    ImagePixels: "image_pixels",
    VideoPixels: "video_pixels",
    Duration: "duration",
};
export const AggregateEnum = {
    Format: "format",
    ResourceType: "resource_type",
    Type: "type",
};
export const WithField = {
    Context: "context",
    Tags: "tags",
    ImageMetadata: "image_metadata",
    ImageAnalysis: "image_analysis",
    Metadata: "metadata",
    QualityAnalysis: "quality_analysis",
    AccessibilityAnalysis: "accessibility_analysis",
};
/** @internal */
export const SearchParametersType$inboundSchema = z.nativeEnum(SearchParametersType);
/** @internal */
export const SearchParametersType$outboundSchema = SearchParametersType$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var SearchParametersType$;
(function (SearchParametersType$) {
    /** @deprecated use `SearchParametersType$inboundSchema` instead. */
    SearchParametersType$.inboundSchema = SearchParametersType$inboundSchema;
    /** @deprecated use `SearchParametersType$outboundSchema` instead. */
    SearchParametersType$.outboundSchema = SearchParametersType$outboundSchema;
})(SearchParametersType$ || (SearchParametersType$ = {}));
/** @internal */
export const SearchParametersRange$inboundSchema = z.object({
    from: z.number().optional(),
    to: z.number().optional(),
});
/** @internal */
export const SearchParametersRange$outboundSchema = z.object({
    from: z.number().optional(),
    to: 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 SearchParametersRange$;
(function (SearchParametersRange$) {
    /** @deprecated use `SearchParametersRange$inboundSchema` instead. */
    SearchParametersRange$.inboundSchema = SearchParametersRange$inboundSchema;
    /** @deprecated use `SearchParametersRange$outboundSchema` instead. */
    SearchParametersRange$.outboundSchema = SearchParametersRange$outboundSchema;
})(SearchParametersRange$ || (SearchParametersRange$ = {}));
export function searchParametersRangeToJSON(searchParametersRange) {
    return JSON.stringify(SearchParametersRange$outboundSchema.parse(searchParametersRange));
}
export function searchParametersRangeFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SearchParametersRange$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SearchParametersRange' from JSON`);
}
/** @internal */
export const Aggregate$inboundSchema = z.object({
    type: SearchParametersType$inboundSchema,
    ranges: z.array(z.lazy(() => SearchParametersRange$inboundSchema)),
});
/** @internal */
export const Aggregate$outboundSchema = z.object({
    type: SearchParametersType$outboundSchema,
    ranges: z.array(z.lazy(() => SearchParametersRange$outboundSchema)),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Aggregate$;
(function (Aggregate$) {
    /** @deprecated use `Aggregate$inboundSchema` instead. */
    Aggregate$.inboundSchema = Aggregate$inboundSchema;
    /** @deprecated use `Aggregate$outboundSchema` instead. */
    Aggregate$.outboundSchema = Aggregate$outboundSchema;
})(Aggregate$ || (Aggregate$ = {}));
export function aggregateToJSON(aggregate) {
    return JSON.stringify(Aggregate$outboundSchema.parse(aggregate));
}
export function aggregateFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Aggregate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Aggregate' from JSON`);
}
/** @internal */
export const AggregateEnum$inboundSchema = z.nativeEnum(AggregateEnum);
/** @internal */
export const AggregateEnum$outboundSchema = AggregateEnum$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var AggregateEnum$;
(function (AggregateEnum$) {
    /** @deprecated use `AggregateEnum$inboundSchema` instead. */
    AggregateEnum$.inboundSchema = AggregateEnum$inboundSchema;
    /** @deprecated use `AggregateEnum$outboundSchema` instead. */
    AggregateEnum$.outboundSchema = AggregateEnum$outboundSchema;
})(AggregateEnum$ || (AggregateEnum$ = {}));
/** @internal */
export const AggregateUnion$inboundSchema = z.union([
    z.array(AggregateEnum$inboundSchema),
    z.array(z.lazy(() => Aggregate$inboundSchema)),
]);
/** @internal */
export const AggregateUnion$outboundSchema = z.union([
    z.array(AggregateEnum$outboundSchema),
    z.array(z.lazy(() => Aggregate$outboundSchema)),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var AggregateUnion$;
(function (AggregateUnion$) {
    /** @deprecated use `AggregateUnion$inboundSchema` instead. */
    AggregateUnion$.inboundSchema = AggregateUnion$inboundSchema;
    /** @deprecated use `AggregateUnion$outboundSchema` instead. */
    AggregateUnion$.outboundSchema = AggregateUnion$outboundSchema;
})(AggregateUnion$ || (AggregateUnion$ = {}));
export function aggregateUnionToJSON(aggregateUnion) {
    return JSON.stringify(AggregateUnion$outboundSchema.parse(aggregateUnion));
}
export function aggregateUnionFromJSON(jsonString) {
    return safeParse(jsonString, (x) => AggregateUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AggregateUnion' from JSON`);
}
/** @internal */
export const WithField$inboundSchema = z
    .nativeEnum(WithField);
/** @internal */
export const WithField$outboundSchema = WithField$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var WithField$;
(function (WithField$) {
    /** @deprecated use `WithField$inboundSchema` instead. */
    WithField$.inboundSchema = WithField$inboundSchema;
    /** @deprecated use `WithField$outboundSchema` instead. */
    WithField$.outboundSchema = WithField$outboundSchema;
})(WithField$ || (WithField$ = {}));
/** @internal */
export const SearchParameters$inboundSchema = z.object({
    expression: z.string().optional(),
    sort_by: z.array(z.string()).optional(),
    max_results: z.number().int().optional(),
    next_cursor: z.string().optional(),
    aggregate: z.union([
        z.array(AggregateEnum$inboundSchema),
        z.array(z.lazy(() => Aggregate$inboundSchema)),
    ]).optional(),
    with_field: z.array(WithField$inboundSchema).optional(),
    fields: z.string().optional(),
}).transform((v) => {
    return remap$(v, {
        "sort_by": "sortBy",
        "max_results": "maxResults",
        "next_cursor": "nextCursor",
        "with_field": "withField",
    });
});
/** @internal */
export const SearchParameters$outboundSchema = z.object({
    expression: z.string().optional(),
    sortBy: z.array(z.string()).optional(),
    maxResults: z.number().int().optional(),
    nextCursor: z.string().optional(),
    aggregate: z.union([
        z.array(AggregateEnum$outboundSchema),
        z.array(z.lazy(() => Aggregate$outboundSchema)),
    ]).optional(),
    withField: z.array(WithField$outboundSchema).optional(),
    fields: z.string().optional(),
}).transform((v) => {
    return remap$(v, {
        sortBy: "sort_by",
        maxResults: "max_results",
        nextCursor: "next_cursor",
        withField: "with_field",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var SearchParameters$;
(function (SearchParameters$) {
    /** @deprecated use `SearchParameters$inboundSchema` instead. */
    SearchParameters$.inboundSchema = SearchParameters$inboundSchema;
    /** @deprecated use `SearchParameters$outboundSchema` instead. */
    SearchParameters$.outboundSchema = SearchParameters$outboundSchema;
})(SearchParameters$ || (SearchParameters$ = {}));
export function searchParametersToJSON(searchParameters) {
    return JSON.stringify(SearchParameters$outboundSchema.parse(searchParameters));
}
export function searchParametersFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SearchParameters$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SearchParameters' from JSON`);
}
//# sourceMappingURL=searchparameters.js.map