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

export type PostV2ListsListEntriesDataRequest = {
  /**
   * A UUID identifying the record you want to add to the list. The record will become the 'parent' of the created list entry.
   */
  parentRecordId: string;
  /**
   * A UUID or slug identifying the object that the added parent record belongs to.
   */
  parentObject: string;
  /**
   * An object with an attribute `api_slug` or `attribute_id` as the key, and a single value (for single-select attributes), or an array of values (for single or multi-select attributes) as the values. For complete documentation on values for all attribute types, please see our [attribute type docs](/docs/attribute-types).
   */
  entryValues: { [k: string]: any };
};

export type PostV2ListsListEntriesRequestBody = {
  data: PostV2ListsListEntriesDataRequest;
};

export type PostV2ListsListEntriesRequest = {
  list: string;
  requestBody: PostV2ListsListEntriesRequestBody;
};

export type PostV2ListsListEntriesId = {
  /**
   * A UUID identifying the workspace this entry belongs to.
   */
  workspaceId: string;
  /**
   * A UUID identifying the list this entry is in.
   */
  listId: string;
  /**
   * A UUID identifying this entry.
   */
  entryId: string;
};

/**
 * A list of attribute values for the list entry (not attribute values for its parent record).
 */
export type PostV2ListsListEntriesEntryValues = {};

export type PostV2ListsListEntriesDataResponse = {
  id: PostV2ListsListEntriesId;
  /**
   * A UUID identifying the record that is parent of the list entry.
   */
  parentRecordId: string;
  /**
   * A UUID or slug identifying the object that the parent record belongs to.
   */
  parentObject: string;
  /**
   * When this entry was created.
   */
  createdAt: string;
  /**
   * A list of attribute values for the list entry (not attribute values for its parent record).
   */
  entryValues: PostV2ListsListEntriesEntryValues;
};

/**
 * Success
 */
export type PostV2ListsListEntriesResponse = {
  data: PostV2ListsListEntriesDataResponse;
};

/** @internal */
export const PostV2ListsListEntriesDataRequest$inboundSchema: z.ZodType<
  PostV2ListsListEntriesDataRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  parent_record_id: z.string(),
  parent_object: z.string(),
  entry_values: z.record(z.any()),
}).transform((v) => {
  return remap$(v, {
    "parent_record_id": "parentRecordId",
    "parent_object": "parentObject",
    "entry_values": "entryValues",
  });
});

/** @internal */
export type PostV2ListsListEntriesDataRequest$Outbound = {
  parent_record_id: string;
  parent_object: string;
  entry_values: { [k: string]: any };
};

/** @internal */
export const PostV2ListsListEntriesDataRequest$outboundSchema: z.ZodType<
  PostV2ListsListEntriesDataRequest$Outbound,
  z.ZodTypeDef,
  PostV2ListsListEntriesDataRequest
> = z.object({
  parentRecordId: z.string(),
  parentObject: z.string(),
  entryValues: z.record(z.any()),
}).transform((v) => {
  return remap$(v, {
    parentRecordId: "parent_record_id",
    parentObject: "parent_object",
    entryValues: "entry_values",
  });
});

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

export function postV2ListsListEntriesDataRequestToJSON(
  postV2ListsListEntriesDataRequest: PostV2ListsListEntriesDataRequest,
): string {
  return JSON.stringify(
    PostV2ListsListEntriesDataRequest$outboundSchema.parse(
      postV2ListsListEntriesDataRequest,
    ),
  );
}

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

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

/** @internal */
export type PostV2ListsListEntriesRequestBody$Outbound = {
  data: PostV2ListsListEntriesDataRequest$Outbound;
};

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

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

export function postV2ListsListEntriesRequestBodyToJSON(
  postV2ListsListEntriesRequestBody: PostV2ListsListEntriesRequestBody,
): string {
  return JSON.stringify(
    PostV2ListsListEntriesRequestBody$outboundSchema.parse(
      postV2ListsListEntriesRequestBody,
    ),
  );
}

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

/** @internal */
export const PostV2ListsListEntriesRequest$inboundSchema: z.ZodType<
  PostV2ListsListEntriesRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  list: z.string(),
  RequestBody: z.lazy(() => PostV2ListsListEntriesRequestBody$inboundSchema),
}).transform((v) => {
  return remap$(v, {
    "RequestBody": "requestBody",
  });
});

/** @internal */
export type PostV2ListsListEntriesRequest$Outbound = {
  list: string;
  RequestBody: PostV2ListsListEntriesRequestBody$Outbound;
};

/** @internal */
export const PostV2ListsListEntriesRequest$outboundSchema: z.ZodType<
  PostV2ListsListEntriesRequest$Outbound,
  z.ZodTypeDef,
  PostV2ListsListEntriesRequest
> = z.object({
  list: z.string(),
  requestBody: z.lazy(() => PostV2ListsListEntriesRequestBody$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 PostV2ListsListEntriesRequest$ {
  /** @deprecated use `PostV2ListsListEntriesRequest$inboundSchema` instead. */
  export const inboundSchema = PostV2ListsListEntriesRequest$inboundSchema;
  /** @deprecated use `PostV2ListsListEntriesRequest$outboundSchema` instead. */
  export const outboundSchema = PostV2ListsListEntriesRequest$outboundSchema;
  /** @deprecated use `PostV2ListsListEntriesRequest$Outbound` instead. */
  export type Outbound = PostV2ListsListEntriesRequest$Outbound;
}

export function postV2ListsListEntriesRequestToJSON(
  postV2ListsListEntriesRequest: PostV2ListsListEntriesRequest,
): string {
  return JSON.stringify(
    PostV2ListsListEntriesRequest$outboundSchema.parse(
      postV2ListsListEntriesRequest,
    ),
  );
}

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

/** @internal */
export const PostV2ListsListEntriesId$inboundSchema: z.ZodType<
  PostV2ListsListEntriesId,
  z.ZodTypeDef,
  unknown
> = z.object({
  workspace_id: z.string(),
  list_id: z.string(),
  entry_id: z.string(),
}).transform((v) => {
  return remap$(v, {
    "workspace_id": "workspaceId",
    "list_id": "listId",
    "entry_id": "entryId",
  });
});

/** @internal */
export type PostV2ListsListEntriesId$Outbound = {
  workspace_id: string;
  list_id: string;
  entry_id: string;
};

/** @internal */
export const PostV2ListsListEntriesId$outboundSchema: z.ZodType<
  PostV2ListsListEntriesId$Outbound,
  z.ZodTypeDef,
  PostV2ListsListEntriesId
> = z.object({
  workspaceId: z.string(),
  listId: z.string(),
  entryId: z.string(),
}).transform((v) => {
  return remap$(v, {
    workspaceId: "workspace_id",
    listId: "list_id",
    entryId: "entry_id",
  });
});

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

export function postV2ListsListEntriesIdToJSON(
  postV2ListsListEntriesId: PostV2ListsListEntriesId,
): string {
  return JSON.stringify(
    PostV2ListsListEntriesId$outboundSchema.parse(postV2ListsListEntriesId),
  );
}

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

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

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

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

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

export function postV2ListsListEntriesEntryValuesToJSON(
  postV2ListsListEntriesEntryValues: PostV2ListsListEntriesEntryValues,
): string {
  return JSON.stringify(
    PostV2ListsListEntriesEntryValues$outboundSchema.parse(
      postV2ListsListEntriesEntryValues,
    ),
  );
}

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

/** @internal */
export const PostV2ListsListEntriesDataResponse$inboundSchema: z.ZodType<
  PostV2ListsListEntriesDataResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.lazy(() => PostV2ListsListEntriesId$inboundSchema),
  parent_record_id: z.string(),
  parent_object: z.string(),
  created_at: z.string(),
  entry_values: z.lazy(() => PostV2ListsListEntriesEntryValues$inboundSchema),
}).transform((v) => {
  return remap$(v, {
    "parent_record_id": "parentRecordId",
    "parent_object": "parentObject",
    "created_at": "createdAt",
    "entry_values": "entryValues",
  });
});

/** @internal */
export type PostV2ListsListEntriesDataResponse$Outbound = {
  id: PostV2ListsListEntriesId$Outbound;
  parent_record_id: string;
  parent_object: string;
  created_at: string;
  entry_values: PostV2ListsListEntriesEntryValues$Outbound;
};

/** @internal */
export const PostV2ListsListEntriesDataResponse$outboundSchema: z.ZodType<
  PostV2ListsListEntriesDataResponse$Outbound,
  z.ZodTypeDef,
  PostV2ListsListEntriesDataResponse
> = z.object({
  id: z.lazy(() => PostV2ListsListEntriesId$outboundSchema),
  parentRecordId: z.string(),
  parentObject: z.string(),
  createdAt: z.string(),
  entryValues: z.lazy(() => PostV2ListsListEntriesEntryValues$outboundSchema),
}).transform((v) => {
  return remap$(v, {
    parentRecordId: "parent_record_id",
    parentObject: "parent_object",
    createdAt: "created_at",
    entryValues: "entry_values",
  });
});

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

export function postV2ListsListEntriesDataResponseToJSON(
  postV2ListsListEntriesDataResponse: PostV2ListsListEntriesDataResponse,
): string {
  return JSON.stringify(
    PostV2ListsListEntriesDataResponse$outboundSchema.parse(
      postV2ListsListEntriesDataResponse,
    ),
  );
}

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

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

/** @internal */
export type PostV2ListsListEntriesResponse$Outbound = {
  data: PostV2ListsListEntriesDataResponse$Outbound;
};

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

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

export function postV2ListsListEntriesResponseToJSON(
  postV2ListsListEntriesResponse: PostV2ListsListEntriesResponse,
): string {
  return JSON.stringify(
    PostV2ListsListEntriesResponse$outboundSchema.parse(
      postV2ListsListEntriesResponse,
    ),
  );
}

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