/** Public events for one route-scoped Payment actor. */
import type { PayChannel } from "@/data/schemas/payment";
import type { PaymentPlanCatalog } from "./payment-state";

export type PaymentEvent =
  | {
      type: "PaymentInit";
      payChannel?: PayChannel;
      catalog?: PaymentPlanCatalog;
      characterId?: string;
      category?: string | null;
      planId?: string | null;
      autoRenew?: boolean;
      commercialOfferId?: string | null;
      chatActionId?: string | null;
    }
  | { type: "PaymentPlanSelected"; planId: string }
  | { type: "PaymentPayChannelChanged"; payChannel: PayChannel }
  | { type: "PaymentAutoRenewChanged"; autoRenew: boolean }
  | { type: "PaymentAgreementChanged"; agreed: boolean }
  | {
      type: "PaymentCreateOrderSubmitted";
      recipientCharacterId?: string;
    }
  | { type: "PaymentReturned"; orderId: string; createdAt?: number }
  | { type: "PaymentLaunchFailed"; errorMessage: string }
  | { type: "PaymentFirstRechargeConsumed" }
  | { type: "PaymentCatalogRetryRequested" }
  | { type: "PaymentTipMessageRetryRequested" }
  | { type: "PaymentErrorCleared" }
  | { type: "PaymentReset" };
