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 ModuleConfig = class {
  constructor() {
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], ModuleConfig.prototype, "id", 2);
__decorateClass([
  Property({ name: "module_id", type: "text" })
], ModuleConfig.prototype, "moduleId", 2);
__decorateClass([
  Property({ name: "name", type: "text" })
], ModuleConfig.prototype, "name", 2);
__decorateClass([
  Property({ name: "value_json", type: "json", nullable: true })
], ModuleConfig.prototype, "valueJson", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid", nullable: true })
], ModuleConfig.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid", nullable: true })
], ModuleConfig.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], ModuleConfig.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], ModuleConfig.prototype, "updatedAt", 2);
ModuleConfig = __decorateClass([
  Entity({ tableName: "module_configs" }),
  Index({
    name: "module_configs_global_unique",
    expression: 'create unique index "module_configs_global_unique" on "module_configs" ("module_id", "name") where "tenant_id" is null'
  }),
  Index({
    name: "module_configs_scoped_unique",
    expression: 'create unique index "module_configs_scoped_unique" on "module_configs" ("module_id", "name", "tenant_id") where "tenant_id" is not null'
  }),
  Index({ name: "module_configs_module_name_tenant_idx", properties: ["moduleId", "name", "tenantId"] })
], ModuleConfig);
OptionalProps;
let UpgradeActionRun = class {
  constructor() {
    this.completedAt = /* @__PURE__ */ new Date();
    this.createdAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], UpgradeActionRun.prototype, "id", 2);
__decorateClass([
  Property({ name: "version", type: "text" })
], UpgradeActionRun.prototype, "version", 2);
__decorateClass([
  Property({ name: "action_id", type: "text" })
], UpgradeActionRun.prototype, "actionId", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], UpgradeActionRun.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], UpgradeActionRun.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "completed_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], UpgradeActionRun.prototype, "completedAt", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], UpgradeActionRun.prototype, "createdAt", 2);
UpgradeActionRun = __decorateClass([
  Entity({ tableName: "upgrade_action_runs" }),
  Index({ name: "upgrade_action_runs_scope_idx", properties: ["organizationId", "tenantId"] }),
  Unique({ name: "upgrade_action_runs_action_scope_unique", properties: ["version", "actionId", "organizationId", "tenantId"] })
], UpgradeActionRun);
export {
  ModuleConfig,
  UpgradeActionRun
};
//# sourceMappingURL=entities.js.map
