/*
 * 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";
import { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import {
  SelectOption,
  SelectOption$inboundSchema,
  SelectOption$Outbound,
  SelectOption$outboundSchema,
} from "../components/selectoption.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

/**
 * Whether the attribute is on an object or a list.
 */
export const PostV2TargetIdentifierAttributesAttributeOptionsTarget = {
  Objects: "objects",
  Lists: "lists",
} as const;
/**
 * Whether the attribute is on an object or a list.
 */
export type PostV2TargetIdentifierAttributesAttributeOptionsTarget = ClosedEnum<
  typeof PostV2TargetIdentifierAttributesAttributeOptionsTarget
>;

export type PostV2TargetIdentifierAttributesAttributeOptionsData = {
  /**
   * The Title of the select option
   */
  title: string;
};

export type PostV2TargetIdentifierAttributesAttributeOptionsRequestBody = {
  data: PostV2TargetIdentifierAttributesAttributeOptionsData;
};

export type PostV2TargetIdentifierAttributesAttributeOptionsRequest = {
  /**
   * Whether the attribute is on an object or a list.
   */
  target: PostV2TargetIdentifierAttributesAttributeOptionsTarget;
  identifier: string;
  attribute: string;
  requestBody: PostV2TargetIdentifierAttributesAttributeOptionsRequestBody;
};

/**
 * Success
 */
export type PostV2TargetIdentifierAttributesAttributeOptionsResponse = {
  data: SelectOption;
};

/** @internal */
export const PostV2TargetIdentifierAttributesAttributeOptionsTarget$inboundSchema:
  z.ZodNativeEnum<
    typeof PostV2TargetIdentifierAttributesAttributeOptionsTarget
  > = z.nativeEnum(PostV2TargetIdentifierAttributesAttributeOptionsTarget);

/** @internal */
export const PostV2TargetIdentifierAttributesAttributeOptionsTarget$outboundSchema:
  z.ZodNativeEnum<
    typeof PostV2TargetIdentifierAttributesAttributeOptionsTarget
  > = PostV2TargetIdentifierAttributesAttributeOptionsTarget$inboundSchema;

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

/** @internal */
export const PostV2TargetIdentifierAttributesAttributeOptionsData$inboundSchema:
  z.ZodType<
    PostV2TargetIdentifierAttributesAttributeOptionsData,
    z.ZodTypeDef,
    unknown
  > = z.object({
    title: z.string(),
  });

/** @internal */
export type PostV2TargetIdentifierAttributesAttributeOptionsData$Outbound = {
  title: string;
};

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

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

export function postV2TargetIdentifierAttributesAttributeOptionsDataToJSON(
  postV2TargetIdentifierAttributesAttributeOptionsData:
    PostV2TargetIdentifierAttributesAttributeOptionsData,
): string {
  return JSON.stringify(
    PostV2TargetIdentifierAttributesAttributeOptionsData$outboundSchema.parse(
      postV2TargetIdentifierAttributesAttributeOptionsData,
    ),
  );
}

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

/** @internal */
export const PostV2TargetIdentifierAttributesAttributeOptionsRequestBody$inboundSchema:
  z.ZodType<
    PostV2TargetIdentifierAttributesAttributeOptionsRequestBody,
    z.ZodTypeDef,
    unknown
  > = z.object({
    data: z.lazy(() =>
      PostV2TargetIdentifierAttributesAttributeOptionsData$inboundSchema
    ),
  });

/** @internal */
export type PostV2TargetIdentifierAttributesAttributeOptionsRequestBody$Outbound =
  {
    data: PostV2TargetIdentifierAttributesAttributeOptionsData$Outbound;
  };

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

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

export function postV2TargetIdentifierAttributesAttributeOptionsRequestBodyToJSON(
  postV2TargetIdentifierAttributesAttributeOptionsRequestBody:
    PostV2TargetIdentifierAttributesAttributeOptionsRequestBody,
): string {
  return JSON.stringify(
    PostV2TargetIdentifierAttributesAttributeOptionsRequestBody$outboundSchema
      .parse(postV2TargetIdentifierAttributesAttributeOptionsRequestBody),
  );
}

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

/** @internal */
export const PostV2TargetIdentifierAttributesAttributeOptionsRequest$inboundSchema:
  z.ZodType<
    PostV2TargetIdentifierAttributesAttributeOptionsRequest,
    z.ZodTypeDef,
    unknown
  > = z.object({
    target:
      PostV2TargetIdentifierAttributesAttributeOptionsTarget$inboundSchema,
    identifier: z.string(),
    attribute: z.string(),
    RequestBody: z.lazy(() =>
      PostV2TargetIdentifierAttributesAttributeOptionsRequestBody$inboundSchema
    ),
  }).transform((v) => {
    return remap$(v, {
      "RequestBody": "requestBody",
    });
  });

/** @internal */
export type PostV2TargetIdentifierAttributesAttributeOptionsRequest$Outbound = {
  target: string;
  identifier: string;
  attribute: string;
  RequestBody:
    PostV2TargetIdentifierAttributesAttributeOptionsRequestBody$Outbound;
};

/** @internal */
export const PostV2TargetIdentifierAttributesAttributeOptionsRequest$outboundSchema:
  z.ZodType<
    PostV2TargetIdentifierAttributesAttributeOptionsRequest$Outbound,
    z.ZodTypeDef,
    PostV2TargetIdentifierAttributesAttributeOptionsRequest
  > = z.object({
    target:
      PostV2TargetIdentifierAttributesAttributeOptionsTarget$outboundSchema,
    identifier: z.string(),
    attribute: z.string(),
    requestBody: z.lazy(() =>
      PostV2TargetIdentifierAttributesAttributeOptionsRequestBody$outboundSchema
    ),
  }).transform((v) => {
    return remap$(v, {
      requestBody: "RequestBody",
    });
  });

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

export function postV2TargetIdentifierAttributesAttributeOptionsRequestToJSON(
  postV2TargetIdentifierAttributesAttributeOptionsRequest:
    PostV2TargetIdentifierAttributesAttributeOptionsRequest,
): string {
  return JSON.stringify(
    PostV2TargetIdentifierAttributesAttributeOptionsRequest$outboundSchema
      .parse(postV2TargetIdentifierAttributesAttributeOptionsRequest),
  );
}

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

/** @internal */
export const PostV2TargetIdentifierAttributesAttributeOptionsResponse$inboundSchema:
  z.ZodType<
    PostV2TargetIdentifierAttributesAttributeOptionsResponse,
    z.ZodTypeDef,
    unknown
  > = z.object({
    data: SelectOption$inboundSchema,
  });

/** @internal */
export type PostV2TargetIdentifierAttributesAttributeOptionsResponse$Outbound =
  {
    data: SelectOption$Outbound;
  };

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

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

export function postV2TargetIdentifierAttributesAttributeOptionsResponseToJSON(
  postV2TargetIdentifierAttributesAttributeOptionsResponse:
    PostV2TargetIdentifierAttributesAttributeOptionsResponse,
): string {
  return JSON.stringify(
    PostV2TargetIdentifierAttributesAttributeOptionsResponse$outboundSchema
      .parse(postV2TargetIdentifierAttributesAttributeOptionsResponse),
  );
}

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