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

import * as z from "zod/v4-mini";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import {
  ListResourceCustomerSubscription,
  ListResourceCustomerSubscription$inboundSchema,
} from "../components/listresourcecustomersubscription.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type CustomerPortalSeatsListClaimedSubscriptionsSecurity = {
  customerSession?: string | undefined;
  memberSession?: string | undefined;
};

export type CustomerPortalSeatsListClaimedSubscriptionsRequest = {
  /**
   * Page number, defaults to 1.
   */
  page?: number | undefined;
  /**
   * Size of a page, defaults to 10. Maximum is 100.
   */
  limit?: number | undefined;
};

export type CustomerPortalSeatsListClaimedSubscriptionsResponse = {
  result: ListResourceCustomerSubscription;
};

/** @internal */
export type CustomerPortalSeatsListClaimedSubscriptionsSecurity$Outbound = {
  customer_session?: string | undefined;
  member_session?: string | undefined;
};

/** @internal */
export const CustomerPortalSeatsListClaimedSubscriptionsSecurity$outboundSchema:
  z.ZodMiniType<
    CustomerPortalSeatsListClaimedSubscriptionsSecurity$Outbound,
    CustomerPortalSeatsListClaimedSubscriptionsSecurity
  > = z.pipe(
    z.object({
      customerSession: z.optional(z.string()),
      memberSession: z.optional(z.string()),
    }),
    z.transform((v) => {
      return remap$(v, {
        customerSession: "customer_session",
        memberSession: "member_session",
      });
    }),
  );

export function customerPortalSeatsListClaimedSubscriptionsSecurityToJSON(
  customerPortalSeatsListClaimedSubscriptionsSecurity:
    CustomerPortalSeatsListClaimedSubscriptionsSecurity,
): string {
  return JSON.stringify(
    CustomerPortalSeatsListClaimedSubscriptionsSecurity$outboundSchema.parse(
      customerPortalSeatsListClaimedSubscriptionsSecurity,
    ),
  );
}

/** @internal */
export type CustomerPortalSeatsListClaimedSubscriptionsRequest$Outbound = {
  page: number;
  limit: number;
};

/** @internal */
export const CustomerPortalSeatsListClaimedSubscriptionsRequest$outboundSchema:
  z.ZodMiniType<
    CustomerPortalSeatsListClaimedSubscriptionsRequest$Outbound,
    CustomerPortalSeatsListClaimedSubscriptionsRequest
  > = z.object({
    page: z._default(z.int(), 1),
    limit: z._default(z.int(), 10),
  });

export function customerPortalSeatsListClaimedSubscriptionsRequestToJSON(
  customerPortalSeatsListClaimedSubscriptionsRequest:
    CustomerPortalSeatsListClaimedSubscriptionsRequest,
): string {
  return JSON.stringify(
    CustomerPortalSeatsListClaimedSubscriptionsRequest$outboundSchema.parse(
      customerPortalSeatsListClaimedSubscriptionsRequest,
    ),
  );
}

/** @internal */
export const CustomerPortalSeatsListClaimedSubscriptionsResponse$inboundSchema:
  z.ZodMiniType<CustomerPortalSeatsListClaimedSubscriptionsResponse, unknown> =
    z.pipe(
      z.object({
        Result: ListResourceCustomerSubscription$inboundSchema,
      }),
      z.transform((v) => {
        return remap$(v, {
          "Result": "result",
        });
      }),
    );

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