/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod";
import { remap as remap$ } from "../../../lib/primitives.js";

export const GetGeoDataServerList = [
  "https://plex.tv/api/v2",
] as const;

/**
 * Geo location data
 */
export type GetGeoDataGeoData = {
  /**
   * The ISO 3166-1 alpha-2 code of the country.
   */
  code: string;
  /**
   * The continent code where the country is located.
   */
  continentCode: string;
  /**
   * The official name of the country.
   */
  country: string;
  /**
   * The name of the city.
   */
  city: string;
  /**
   * Indicates if the country is a member of the European Union.
   */
  europeanUnionMember?: boolean | undefined;
  /**
   * The time zone of the country.
   */
  timeZone: string;
  /**
   * The postal code of the location.
   */
  postalCode: string;
  /**
   * Indicates if the country has privacy restrictions.
   */
  inPrivacyRestrictedCountry?: boolean | undefined;
  /**
   * Indicates if the region has privacy restrictions.
   */
  inPrivacyRestrictedRegion?: boolean | undefined;
  /**
   * The name of the primary administrative subdivision.
   */
  subdivisions: string;
  /**
   * The geographical coordinates (latitude, longitude) of the location.
   */
  coordinates: string;
};

export type GetGeoDataResponse = {
  /**
   * 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;
  /**
   * Gets the geo location data of the user
   */
  geoData?: GetGeoDataGeoData | undefined;
};

/** @internal */
export const GetGeoDataGeoData$inboundSchema: z.ZodType<
  GetGeoDataGeoData,
  z.ZodTypeDef,
  unknown
> = z.object({
  code: z.string(),
  continent_code: z.string(),
  country: z.string(),
  city: z.string(),
  european_union_member: z.boolean().default(false),
  time_zone: z.string(),
  postal_code: z.string(),
  in_privacy_restricted_country: z.boolean().default(false),
  in_privacy_restricted_region: z.boolean().default(false),
  subdivisions: z.string(),
  coordinates: z.string(),
}).transform((v) => {
  return remap$(v, {
    "continent_code": "continentCode",
    "european_union_member": "europeanUnionMember",
    "time_zone": "timeZone",
    "postal_code": "postalCode",
    "in_privacy_restricted_country": "inPrivacyRestrictedCountry",
    "in_privacy_restricted_region": "inPrivacyRestrictedRegion",
  });
});

/** @internal */
export type GetGeoDataGeoData$Outbound = {
  code: string;
  continent_code: string;
  country: string;
  city: string;
  european_union_member: boolean;
  time_zone: string;
  postal_code: string;
  in_privacy_restricted_country: boolean;
  in_privacy_restricted_region: boolean;
  subdivisions: string;
  coordinates: string;
};

/** @internal */
export const GetGeoDataGeoData$outboundSchema: z.ZodType<
  GetGeoDataGeoData$Outbound,
  z.ZodTypeDef,
  GetGeoDataGeoData
> = z.object({
  code: z.string(),
  continentCode: z.string(),
  country: z.string(),
  city: z.string(),
  europeanUnionMember: z.boolean().default(false),
  timeZone: z.string(),
  postalCode: z.string(),
  inPrivacyRestrictedCountry: z.boolean().default(false),
  inPrivacyRestrictedRegion: z.boolean().default(false),
  subdivisions: z.string(),
  coordinates: z.string(),
}).transform((v) => {
  return remap$(v, {
    continentCode: "continent_code",
    europeanUnionMember: "european_union_member",
    timeZone: "time_zone",
    postalCode: "postal_code",
    inPrivacyRestrictedCountry: "in_privacy_restricted_country",
    inPrivacyRestrictedRegion: "in_privacy_restricted_region",
  });
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetGeoDataGeoData$ {
  /** @deprecated use `GetGeoDataGeoData$inboundSchema` instead. */
  export const inboundSchema = GetGeoDataGeoData$inboundSchema;
  /** @deprecated use `GetGeoDataGeoData$outboundSchema` instead. */
  export const outboundSchema = GetGeoDataGeoData$outboundSchema;
  /** @deprecated use `GetGeoDataGeoData$Outbound` instead. */
  export type Outbound = GetGeoDataGeoData$Outbound;
}

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

/** @internal */
export type GetGeoDataResponse$Outbound = {
  ContentType: string;
  StatusCode: number;
  RawResponse: never;
  GeoData?: GetGeoDataGeoData$Outbound | undefined;
};

/** @internal */
export const GetGeoDataResponse$outboundSchema: z.ZodType<
  GetGeoDataResponse$Outbound,
  z.ZodTypeDef,
  GetGeoDataResponse
> = z.object({
  contentType: z.string(),
  statusCode: z.number().int(),
  rawResponse: z.instanceof(Response).transform(() => {
    throw new Error("Response cannot be serialized");
  }),
  geoData: z.lazy(() => GetGeoDataGeoData$outboundSchema).optional(),
}).transform((v) => {
  return remap$(v, {
    contentType: "ContentType",
    statusCode: "StatusCode",
    rawResponse: "RawResponse",
    geoData: "GeoData",
  });
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetGeoDataResponse$ {
  /** @deprecated use `GetGeoDataResponse$inboundSchema` instead. */
  export const inboundSchema = GetGeoDataResponse$inboundSchema;
  /** @deprecated use `GetGeoDataResponse$outboundSchema` instead. */
  export const outboundSchema = GetGeoDataResponse$outboundSchema;
  /** @deprecated use `GetGeoDataResponse$Outbound` instead. */
  export type Outbound = GetGeoDataResponse$Outbound;
}
