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 { Entity, Index, PrimaryKey, Property, Unique } from "@mikro-orm/decorators/legacy";
let Currency = class {
  constructor() {
    this.decimalPlaces = 2;
    this.isBase = false;
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], Currency.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], Currency.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], Currency.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], Currency.prototype, "code", 2);
__decorateClass([
  Property({ type: "text" })
], Currency.prototype, "name", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], Currency.prototype, "symbol", 2);
__decorateClass([
  Property({ name: "decimal_places", type: "integer", default: 2 })
], Currency.prototype, "decimalPlaces", 2);
__decorateClass([
  Property({ name: "thousands_separator", type: "text", nullable: true })
], Currency.prototype, "thousandsSeparator", 2);
__decorateClass([
  Property({ name: "decimal_separator", type: "text", nullable: true })
], Currency.prototype, "decimalSeparator", 2);
__decorateClass([
  Property({ name: "is_base", type: "boolean", default: false })
], Currency.prototype, "isBase", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], Currency.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], Currency.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], Currency.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], Currency.prototype, "deletedAt", 2);
Currency = __decorateClass([
  Entity({ tableName: "currencies" }),
  Index({
    name: "currencies_scope_idx",
    properties: ["organizationId", "tenantId"]
  }),
  Unique({
    name: "currencies_code_scope_unique",
    properties: ["organizationId", "tenantId", "code"]
  })
], Currency);
let ExchangeRate = class {
  constructor() {
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], ExchangeRate.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], ExchangeRate.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], ExchangeRate.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "from_currency_code", type: "text" })
], ExchangeRate.prototype, "fromCurrencyCode", 2);
__decorateClass([
  Property({ name: "to_currency_code", type: "text" })
], ExchangeRate.prototype, "toCurrencyCode", 2);
__decorateClass([
  Property({ type: "numeric", precision: 18, scale: 8 })
], ExchangeRate.prototype, "rate", 2);
__decorateClass([
  Property({ name: "date", type: "timestamptz" })
], ExchangeRate.prototype, "date", 2);
__decorateClass([
  Property({ type: "text" })
], ExchangeRate.prototype, "source", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], ExchangeRate.prototype, "type", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], ExchangeRate.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], ExchangeRate.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], ExchangeRate.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], ExchangeRate.prototype, "deletedAt", 2);
ExchangeRate = __decorateClass([
  Entity({ tableName: "exchange_rates" }),
  Index({
    name: "exchange_rates_scope_idx",
    properties: ["organizationId", "tenantId"]
  }),
  Index({
    name: "exchange_rates_pair_idx",
    properties: ["fromCurrencyCode", "toCurrencyCode", "date"]
  }),
  Unique({
    name: "exchange_rates_pair_datetime_source_unique",
    properties: ["organizationId", "tenantId", "fromCurrencyCode", "toCurrencyCode", "date", "source"]
  })
], ExchangeRate);
let CurrencyFetchConfig = class {
  constructor() {
    this.isEnabled = false;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CurrencyFetchConfig.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CurrencyFetchConfig.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CurrencyFetchConfig.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], CurrencyFetchConfig.prototype, "provider", 2);
__decorateClass([
  Property({ name: "is_enabled", type: "boolean", default: false })
], CurrencyFetchConfig.prototype, "isEnabled", 2);
__decorateClass([
  Property({ name: "sync_time", type: "text", nullable: true })
], CurrencyFetchConfig.prototype, "syncTime", 2);
__decorateClass([
  Property({ name: "last_sync_at", type: "timestamptz", nullable: true })
], CurrencyFetchConfig.prototype, "lastSyncAt", 2);
__decorateClass([
  Property({ name: "last_sync_status", type: "text", nullable: true })
], CurrencyFetchConfig.prototype, "lastSyncStatus", 2);
__decorateClass([
  Property({ name: "last_sync_message", type: "text", nullable: true })
], CurrencyFetchConfig.prototype, "lastSyncMessage", 2);
__decorateClass([
  Property({ name: "last_sync_count", type: "integer", nullable: true })
], CurrencyFetchConfig.prototype, "lastSyncCount", 2);
__decorateClass([
  Property({ type: "jsonb", nullable: true })
], CurrencyFetchConfig.prototype, "config", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CurrencyFetchConfig.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CurrencyFetchConfig.prototype, "updatedAt", 2);
CurrencyFetchConfig = __decorateClass([
  Entity({ tableName: "currency_fetch_configs" }),
  Index({
    name: "currency_fetch_configs_scope_idx",
    properties: ["organizationId", "tenantId"]
  }),
  Index({
    name: "currency_fetch_configs_enabled_idx",
    properties: ["isEnabled", "syncTime"]
  }),
  Unique({
    name: "currency_fetch_configs_provider_scope_unique",
    properties: ["organizationId", "tenantId", "provider"]
  })
], CurrencyFetchConfig);
export {
  Currency,
  CurrencyFetchConfig,
  ExchangeRate
};
//# sourceMappingURL=entities.js.map
