/*
 * 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";

/**
 * Feature settings that organizations can update themselves.
 *
 * @remarks
 *
 * Other feature settings are managed by Polar staff: they're ignored if
 * provided and keep their current value.
 */
export type OrganizationFeatureSettingsUpdate = {
  /**
   * If this organization has seat-based pricing enabled
   */
  seatBasedPricingEnabled?: boolean | undefined;
  /**
   * If this organization has the Member model enabled
   */
  memberModelEnabled?: boolean | undefined;
  /**
   * If this organization has checkout localization enabled
   */
  checkoutLocalizationEnabled?: boolean | undefined;
  /**
   * Ordered list of metric slugs shown on the dashboard overview.
   */
  overviewMetrics?: Array<string> | null | undefined;
};

/** @internal */
export type OrganizationFeatureSettingsUpdate$Outbound = {
  seat_based_pricing_enabled: boolean;
  member_model_enabled: boolean;
  checkout_localization_enabled: boolean;
  overview_metrics?: Array<string> | null | undefined;
};

/** @internal */
export const OrganizationFeatureSettingsUpdate$outboundSchema: z.ZodMiniType<
  OrganizationFeatureSettingsUpdate$Outbound,
  OrganizationFeatureSettingsUpdate
> = z.pipe(
  z.object({
    seatBasedPricingEnabled: z._default(z.boolean(), false),
    memberModelEnabled: z._default(z.boolean(), false),
    checkoutLocalizationEnabled: z._default(z.boolean(), false),
    overviewMetrics: z.optional(z.nullable(z.array(z.string()))),
  }),
  z.transform((v) => {
    return remap$(v, {
      seatBasedPricingEnabled: "seat_based_pricing_enabled",
      memberModelEnabled: "member_model_enabled",
      checkoutLocalizationEnabled: "checkout_localization_enabled",
      overviewMetrics: "overview_metrics",
    });
  }),
);

export function organizationFeatureSettingsUpdateToJSON(
  organizationFeatureSettingsUpdate: OrganizationFeatureSettingsUpdate,
): string {
  return JSON.stringify(
    OrganizationFeatureSettingsUpdate$outboundSchema.parse(
      organizationFeatureSettingsUpdate,
    ),
  );
}
