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

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

export type GetWorkspaceUsersRequest = {
  /**
   * The ID of the account
   */
  accountId: string;
  /**
   * The ID of the workspace
   */
  workspaceId: string;
  /**
   * Number of workspace users to return. Defaults to the maximum which is 100.
   */
  count?: number | undefined;
  /**
   * Position of the first item in the total results. Defaults to 0.
   */
  startPosition?: number | undefined;
  /**
   * Returns workspace users filtered by Name and Email
   */
  filter?: string | undefined;
  /**
   * Sorts results. Options are `first_name_asc`, `first_name_desc`, `last_name_asc`, `last_name_desc`, `email_asc`, `email_desc`. Defaults to `last_name_desc`
   */
  sort?: components.GetWorkspaceUsersSortingOption | undefined;
};

/** @internal */
export type GetWorkspaceUsersRequest$Outbound = {
  accountId: string;
  workspaceId: string;
  count?: number | undefined;
  start_position?: number | undefined;
  filter?: string | undefined;
  sort?: string | undefined;
};

/** @internal */
export const GetWorkspaceUsersRequest$outboundSchema: z.ZodType<
  GetWorkspaceUsersRequest$Outbound,
  z.ZodTypeDef,
  GetWorkspaceUsersRequest
> = z.object({
  accountId: z.string(),
  workspaceId: z.string(),
  count: z.number().int().optional(),
  startPosition: z.number().int().optional(),
  filter: z.string().optional(),
  sort: components.GetWorkspaceUsersSortingOption$outboundSchema.optional(),
}).transform((v) => {
  return remap$(v, {
    startPosition: "start_position",
  });
});

export function getWorkspaceUsersRequestToJSON(
  getWorkspaceUsersRequest: GetWorkspaceUsersRequest,
): string {
  return JSON.stringify(
    GetWorkspaceUsersRequest$outboundSchema.parse(getWorkspaceUsersRequest),
  );
}
