/*
 * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { CustomerSeat, CustomerSeat$inboundSchema } from "./customerseat.js";

export type SeatsList = {
  /**
   * List of seats
   */
  seats: Array<CustomerSeat>;
  /**
   * Number of available seats
   */
  availableSeats: number;
  /**
   * Total number of seats for the subscription
   */
  totalSeats: number;
};

/** @internal */
export const SeatsList$inboundSchema: z.ZodMiniType<SeatsList, unknown> = z
  .pipe(
    z.object({
      seats: z.array(CustomerSeat$inboundSchema),
      available_seats: z.int(),
      total_seats: z.int(),
    }),
    z.transform((v) => {
      return remap$(v, {
        "available_seats": "availableSeats",
        "total_seats": "totalSeats",
      });
    }),
  );

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