/*
 * 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";
/**
 * Specifies the expression field by which to sort the results. Prepend values with a '-' to reverse the order.
 */
export const SortBy = {
    ViewEndedAt: "view_ended_at",
    VideoDuration: "video_duration",
    ViewWatchTime: "view_watch_time",
    MinusViewEndedAt: "-view_ended_at",
    MinusVideoDuration: "-video_duration",
    MinusViewWatchTime: "-view_watch_time",
};
/** @internal */
export const GetVideoViewsGlobals$inboundSchema = z.object({
    cloud_name: z.string().optional(),
}).transform((v) => {
    return remap$(v, {
        "cloud_name": "cloudName",
    });
});
/** @internal */
export const GetVideoViewsGlobals$outboundSchema = z.object({
    cloudName: z.string().optional(),
}).transform((v) => {
    return remap$(v, {
        cloudName: "cloud_name",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var GetVideoViewsGlobals$;
(function (GetVideoViewsGlobals$) {
    /** @deprecated use `GetVideoViewsGlobals$inboundSchema` instead. */
    GetVideoViewsGlobals$.inboundSchema = GetVideoViewsGlobals$inboundSchema;
    /** @deprecated use `GetVideoViewsGlobals$outboundSchema` instead. */
    GetVideoViewsGlobals$.outboundSchema = GetVideoViewsGlobals$outboundSchema;
})(GetVideoViewsGlobals$ || (GetVideoViewsGlobals$ = {}));
export function getVideoViewsGlobalsToJSON(getVideoViewsGlobals) {
    return JSON.stringify(GetVideoViewsGlobals$outboundSchema.parse(getVideoViewsGlobals));
}
export function getVideoViewsGlobalsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => GetVideoViewsGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetVideoViewsGlobals' from JSON`);
}
/** @internal */
export const SortBy$inboundSchema = z
    .nativeEnum(SortBy);
/** @internal */
export const SortBy$outboundSchema = SortBy$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var SortBy$;
(function (SortBy$) {
    /** @deprecated use `SortBy$inboundSchema` instead. */
    SortBy$.inboundSchema = SortBy$inboundSchema;
    /** @deprecated use `SortBy$outboundSchema` instead. */
    SortBy$.outboundSchema = SortBy$outboundSchema;
})(SortBy$ || (SortBy$ = {}));
/** @internal */
export const GetVideoViewsRequest$inboundSchema = z.object({
    expression: z.string().optional(),
    max_results: z.number().int().default(10),
    sort_by: SortBy$inboundSchema.default("-view_ended_at"),
    next_cursor: z.string().optional(),
}).transform((v) => {
    return remap$(v, {
        "max_results": "maxResults",
        "sort_by": "sortBy",
        "next_cursor": "nextCursor",
    });
});
/** @internal */
export const GetVideoViewsRequest$outboundSchema = z.object({
    expression: z.string().optional(),
    maxResults: z.number().int().default(10),
    sortBy: SortBy$outboundSchema.default("-view_ended_at"),
    nextCursor: z.string().optional(),
}).transform((v) => {
    return remap$(v, {
        maxResults: "max_results",
        sortBy: "sort_by",
        nextCursor: "next_cursor",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var GetVideoViewsRequest$;
(function (GetVideoViewsRequest$) {
    /** @deprecated use `GetVideoViewsRequest$inboundSchema` instead. */
    GetVideoViewsRequest$.inboundSchema = GetVideoViewsRequest$inboundSchema;
    /** @deprecated use `GetVideoViewsRequest$outboundSchema` instead. */
    GetVideoViewsRequest$.outboundSchema = GetVideoViewsRequest$outboundSchema;
})(GetVideoViewsRequest$ || (GetVideoViewsRequest$ = {}));
export function getVideoViewsRequestToJSON(getVideoViewsRequest) {
    return JSON.stringify(GetVideoViewsRequest$outboundSchema.parse(getVideoViewsRequest));
}
export function getVideoViewsRequestFromJSON(jsonString) {
    return safeParse(jsonString, (x) => GetVideoViewsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetVideoViewsRequest' from JSON`);
}
/** @internal */
export const Data$inboundSchema = z
    .object({
    video_public_id: z.string().optional(),
    video_duration: z.nullable(z.number()).optional(),
    video_transformation: z.nullable(z.string()).optional(),
    video_extension: z.nullable(z.string()).optional(),
    viewer_application_name: z.nullable(z.string()).optional(),
    viewer_location_country_code: z.nullable(z.string()).optional(),
    viewer_os_identifier: z.nullable(z.string()).optional(),
    view_watch_time: z.nullable(z.number()).optional(),
    view_ended_at: z.string().datetime({ offset: true }).transform(v => new Date(v)).optional(),
}).transform((v) => {
    return remap$(v, {
        "video_public_id": "videoPublicId",
        "video_duration": "videoDuration",
        "video_transformation": "videoTransformation",
        "video_extension": "videoExtension",
        "viewer_application_name": "viewerApplicationName",
        "viewer_location_country_code": "viewerLocationCountryCode",
        "viewer_os_identifier": "viewerOsIdentifier",
        "view_watch_time": "viewWatchTime",
        "view_ended_at": "viewEndedAt",
    });
});
/** @internal */
export const Data$outboundSchema = z.object({
    videoPublicId: z.string().optional(),
    videoDuration: z.nullable(z.number()).optional(),
    videoTransformation: z.nullable(z.string()).optional(),
    videoExtension: z.nullable(z.string()).optional(),
    viewerApplicationName: z.nullable(z.string()).optional(),
    viewerLocationCountryCode: z.nullable(z.string()).optional(),
    viewerOsIdentifier: z.nullable(z.string()).optional(),
    viewWatchTime: z.nullable(z.number()).optional(),
    viewEndedAt: z.date().transform(v => v.toISOString()).optional(),
}).transform((v) => {
    return remap$(v, {
        videoPublicId: "video_public_id",
        videoDuration: "video_duration",
        videoTransformation: "video_transformation",
        videoExtension: "video_extension",
        viewerApplicationName: "viewer_application_name",
        viewerLocationCountryCode: "viewer_location_country_code",
        viewerOsIdentifier: "viewer_os_identifier",
        viewWatchTime: "view_watch_time",
        viewEndedAt: "view_ended_at",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Data$;
(function (Data$) {
    /** @deprecated use `Data$inboundSchema` instead. */
    Data$.inboundSchema = Data$inboundSchema;
    /** @deprecated use `Data$outboundSchema` instead. */
    Data$.outboundSchema = Data$outboundSchema;
})(Data$ || (Data$ = {}));
export function dataToJSON(data) {
    return JSON.stringify(Data$outboundSchema.parse(data));
}
export function dataFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Data$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Data' from JSON`);
}
/** @internal */
export const GetVideoViewsResponse$inboundSchema = z.object({
    request_id: z.string().optional(),
    next_cursor: z.string().optional(),
    data: z.array(z.lazy(() => Data$inboundSchema)).optional(),
}).transform((v) => {
    return remap$(v, {
        "request_id": "requestId",
        "next_cursor": "nextCursor",
    });
});
/** @internal */
export const GetVideoViewsResponse$outboundSchema = z.object({
    requestId: z.string().optional(),
    nextCursor: z.string().optional(),
    data: z.array(z.lazy(() => Data$outboundSchema)).optional(),
}).transform((v) => {
    return remap$(v, {
        requestId: "request_id",
        nextCursor: "next_cursor",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var GetVideoViewsResponse$;
(function (GetVideoViewsResponse$) {
    /** @deprecated use `GetVideoViewsResponse$inboundSchema` instead. */
    GetVideoViewsResponse$.inboundSchema = GetVideoViewsResponse$inboundSchema;
    /** @deprecated use `GetVideoViewsResponse$outboundSchema` instead. */
    GetVideoViewsResponse$.outboundSchema = GetVideoViewsResponse$outboundSchema;
})(GetVideoViewsResponse$ || (GetVideoViewsResponse$ = {}));
export function getVideoViewsResponseToJSON(getVideoViewsResponse) {
    return JSON.stringify(GetVideoViewsResponse$outboundSchema.parse(getVideoViewsResponse));
}
export function getVideoViewsResponseFromJSON(jsonString) {
    return safeParse(jsonString, (x) => GetVideoViewsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetVideoViewsResponse' from JSON`);
}
//# sourceMappingURL=getvideoviews.js.map