var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
import { OptionalProps } from "@mikro-orm/core";
import { Entity, Index, PrimaryKey, Property, Unique } from "@mikro-orm/decorators/legacy";
OptionalProps;
let GatewayTransaction = class {
  constructor() {
    this.unifiedStatus = "pending";
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], GatewayTransaction.prototype, "id", 2);
__decorateClass([
  Property({ name: "payment_id", type: "uuid" })
], GatewayTransaction.prototype, "paymentId", 2);
__decorateClass([
  Property({ name: "provider_key", type: "text" })
], GatewayTransaction.prototype, "providerKey", 2);
__decorateClass([
  Property({ name: "provider_session_id", type: "text", nullable: true })
], GatewayTransaction.prototype, "providerSessionId", 2);
__decorateClass([
  Property({ name: "gateway_payment_id", type: "text", nullable: true })
], GatewayTransaction.prototype, "gatewayPaymentId", 2);
__decorateClass([
  Property({ name: "gateway_refund_id", type: "text", nullable: true })
], GatewayTransaction.prototype, "gatewayRefundId", 2);
__decorateClass([
  Property({ name: "unified_status", type: "text" })
], GatewayTransaction.prototype, "unifiedStatus", 2);
__decorateClass([
  Property({ name: "gateway_status", type: "text", nullable: true })
], GatewayTransaction.prototype, "gatewayStatus", 2);
__decorateClass([
  Property({ name: "redirect_url", type: "text", nullable: true })
], GatewayTransaction.prototype, "redirectUrl", 2);
__decorateClass([
  Property({ name: "client_secret", type: "text", nullable: true })
], GatewayTransaction.prototype, "clientSecret", 2);
__decorateClass([
  Property({ name: "amount", type: "numeric", precision: 18, scale: 4 })
], GatewayTransaction.prototype, "amount", 2);
__decorateClass([
  Property({ name: "currency_code", type: "text" })
], GatewayTransaction.prototype, "currencyCode", 2);
__decorateClass([
  Property({ name: "gateway_metadata", type: "jsonb", nullable: true })
], GatewayTransaction.prototype, "gatewayMetadata", 2);
__decorateClass([
  Property({ name: "webhook_log", type: "jsonb", nullable: true })
], GatewayTransaction.prototype, "webhookLog", 2);
__decorateClass([
  Property({ name: "last_webhook_at", type: Date, nullable: true })
], GatewayTransaction.prototype, "lastWebhookAt", 2);
__decorateClass([
  Property({ name: "last_polled_at", type: Date, nullable: true })
], GatewayTransaction.prototype, "lastPolledAt", 2);
__decorateClass([
  Property({ name: "expires_at", type: Date, nullable: true })
], GatewayTransaction.prototype, "expiresAt", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], GatewayTransaction.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], GatewayTransaction.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], GatewayTransaction.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], GatewayTransaction.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], GatewayTransaction.prototype, "deletedAt", 2);
GatewayTransaction = __decorateClass([
  Entity({ tableName: "gateway_transactions" }),
  Index({ properties: ["paymentId", "organizationId", "tenantId"] }),
  Index({ properties: ["providerKey", "providerSessionId", "organizationId"] }),
  Index({ properties: ["organizationId", "tenantId", "unifiedStatus"] })
], GatewayTransaction);
OptionalProps;
let WebhookProcessedEvent = class {
  constructor() {
    this.processedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], WebhookProcessedEvent.prototype, "id", 2);
__decorateClass([
  Property({ name: "provider_key", type: "text" })
], WebhookProcessedEvent.prototype, "providerKey", 2);
__decorateClass([
  Property({ name: "idempotency_key", type: "text" })
], WebhookProcessedEvent.prototype, "idempotencyKey", 2);
__decorateClass([
  Property({ name: "event_type", type: "text" })
], WebhookProcessedEvent.prototype, "eventType", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], WebhookProcessedEvent.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], WebhookProcessedEvent.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "processed_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], WebhookProcessedEvent.prototype, "processedAt", 2);
WebhookProcessedEvent = __decorateClass([
  Entity({ tableName: "gateway_webhook_events" }),
  Unique({
    name: "gateway_webhook_events_idempotency_unique",
    properties: ["idempotencyKey", "providerKey", "organizationId", "tenantId"]
  })
], WebhookProcessedEvent);
export {
  GatewayTransaction,
  WebhookProcessedEvent
};
//# sourceMappingURL=entities.js.map
