/*
 * 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";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import * as shared from "../shared/index.js";

export type SetChannelmapGlobals = {
  /**
   * Indicates the client accepts the indicated media types
   */
  accepts?: shared.Accepts | undefined;
  /**
   * An opaque identifier unique to the client
   */
  clientIdentifier?: string | undefined;
  /**
   * The name of the client product
   */
  product?: string | undefined;
  /**
   * The version of the client application
   */
  version?: string | undefined;
  /**
   * The platform of the client
   */
  platform?: string | undefined;
  /**
   * The version of the platform
   */
  platformVersion?: string | undefined;
  /**
   * A relatively friendly name for the client device
   */
  device?: string | undefined;
  /**
   * A potentially less friendly identifier for the device model
   */
  model?: string | undefined;
  /**
   * The device vendor
   */
  deviceVendor?: string | undefined;
  /**
   * A friendly name for the client
   */
  deviceName?: string | undefined;
  /**
   * The marketplace on which the client application is distributed
   */
  marketplace?: string | undefined;
};

/**
 * The mapping of changes, passed as a map of device channel to lineup VCN.
 */
export type SetChannelmapChannelMapping = {};

/**
 * The mapping of changes, passed as a map of device channel to lineup key.
 */
export type ChannelMappingByKey = {};

export type SetChannelmapRequest = {
  /**
   * Indicates the client accepts the indicated media types
   */
  accepts?: shared.Accepts | undefined;
  /**
   * An opaque identifier unique to the client
   */
  clientIdentifier?: string | undefined;
  /**
   * The name of the client product
   */
  product?: string | undefined;
  /**
   * The version of the client application
   */
  version?: string | undefined;
  /**
   * The platform of the client
   */
  platform?: string | undefined;
  /**
   * The version of the platform
   */
  platformVersion?: string | undefined;
  /**
   * A relatively friendly name for the client device
   */
  device?: string | undefined;
  /**
   * A potentially less friendly identifier for the device model
   */
  model?: string | undefined;
  /**
   * The device vendor
   */
  deviceVendor?: string | undefined;
  /**
   * A friendly name for the client
   */
  deviceName?: string | undefined;
  /**
   * The marketplace on which the client application is distributed
   */
  marketplace?: string | undefined;
  /**
   * The ID of the device.
   */
  deviceId: number;
  /**
   * The mapping of changes, passed as a map of device channel to lineup VCN.
   */
  channelMapping?: SetChannelmapChannelMapping | undefined;
  /**
   * The mapping of changes, passed as a map of device channel to lineup key.
   */
  channelMappingByKey?: ChannelMappingByKey | undefined;
  /**
   * The channels which are enabled.
   */
  channelsEnabled?: Array<string> | undefined;
};

export type SetChannelmapResponse = {
  /**
   * HTTP response content type for this operation
   */
  contentType: string;
  /**
   * HTTP response status code for this operation
   */
  statusCode: number;
  /**
   * Raw HTTP response; suitable for custom response parsing
   */
  rawResponse: Response;
  /**
   * OK
   */
  mediaContainerWithDevice?: shared.MediaContainerWithDevice | undefined;
};

/** @internal */
export type SetChannelmapChannelMapping$Outbound = {};

/** @internal */
export const SetChannelmapChannelMapping$outboundSchema: z.ZodType<
  SetChannelmapChannelMapping$Outbound,
  z.ZodTypeDef,
  SetChannelmapChannelMapping
> = z.object({});

export function setChannelmapChannelMappingToJSON(
  setChannelmapChannelMapping: SetChannelmapChannelMapping,
): string {
  return JSON.stringify(
    SetChannelmapChannelMapping$outboundSchema.parse(
      setChannelmapChannelMapping,
    ),
  );
}

/** @internal */
export type ChannelMappingByKey$Outbound = {};

/** @internal */
export const ChannelMappingByKey$outboundSchema: z.ZodType<
  ChannelMappingByKey$Outbound,
  z.ZodTypeDef,
  ChannelMappingByKey
> = z.object({});

export function channelMappingByKeyToJSON(
  channelMappingByKey: ChannelMappingByKey,
): string {
  return JSON.stringify(
    ChannelMappingByKey$outboundSchema.parse(channelMappingByKey),
  );
}

/** @internal */
export type SetChannelmapRequest$Outbound = {
  accepts: string;
  "Client-Identifier"?: string | undefined;
  Product?: string | undefined;
  Version?: string | undefined;
  Platform?: string | undefined;
  "Platform-Version"?: string | undefined;
  Device?: string | undefined;
  Model?: string | undefined;
  "Device-Vendor"?: string | undefined;
  "Device-Name"?: string | undefined;
  Marketplace?: string | undefined;
  deviceId: number;
  channelMapping?: SetChannelmapChannelMapping$Outbound | undefined;
  channelMappingByKey?: ChannelMappingByKey$Outbound | undefined;
  channelsEnabled?: Array<string> | undefined;
};

/** @internal */
export const SetChannelmapRequest$outboundSchema: z.ZodType<
  SetChannelmapRequest$Outbound,
  z.ZodTypeDef,
  SetChannelmapRequest
> = z.object({
  accepts: shared.Accepts$outboundSchema.default(shared.Accepts.ApplicationXml),
  clientIdentifier: z.string().optional(),
  product: z.string().optional(),
  version: z.string().optional(),
  platform: z.string().optional(),
  platformVersion: z.string().optional(),
  device: z.string().optional(),
  model: z.string().optional(),
  deviceVendor: z.string().optional(),
  deviceName: z.string().optional(),
  marketplace: z.string().optional(),
  deviceId: z.number().int(),
  channelMapping: z.lazy(() => SetChannelmapChannelMapping$outboundSchema)
    .optional(),
  channelMappingByKey: z.lazy(() => ChannelMappingByKey$outboundSchema)
    .optional(),
  channelsEnabled: z.array(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    clientIdentifier: "Client-Identifier",
    product: "Product",
    version: "Version",
    platform: "Platform",
    platformVersion: "Platform-Version",
    device: "Device",
    model: "Model",
    deviceVendor: "Device-Vendor",
    deviceName: "Device-Name",
    marketplace: "Marketplace",
  });
});

export function setChannelmapRequestToJSON(
  setChannelmapRequest: SetChannelmapRequest,
): string {
  return JSON.stringify(
    SetChannelmapRequest$outboundSchema.parse(setChannelmapRequest),
  );
}

/** @internal */
export const SetChannelmapResponse$inboundSchema: z.ZodType<
  SetChannelmapResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  ContentType: z.string(),
  StatusCode: z.number().int(),
  RawResponse: z.instanceof(Response),
  MediaContainerWithDevice: shared.MediaContainerWithDevice$inboundSchema
    .optional(),
}).transform((v) => {
  return remap$(v, {
    "ContentType": "contentType",
    "StatusCode": "statusCode",
    "RawResponse": "rawResponse",
    "MediaContainerWithDevice": "mediaContainerWithDevice",
  });
});

export function setChannelmapResponseFromJSON(
  jsonString: string,
): SafeParseResult<SetChannelmapResponse, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => SetChannelmapResponse$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'SetChannelmapResponse' from JSON`,
  );
}
