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 } from "@mikro-orm/decorators/legacy";
OptionalProps;
let SyncRun = class {
  constructor() {
    this.createdCount = 0;
    this.updatedCount = 0;
    this.skippedCount = 0;
    this.failedCount = 0;
    this.batchesCompleted = 0;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], SyncRun.prototype, "id", 2);
__decorateClass([
  Property({ name: "integration_id", type: "text" })
], SyncRun.prototype, "integrationId", 2);
__decorateClass([
  Property({ name: "entity_type", type: "text" })
], SyncRun.prototype, "entityType", 2);
__decorateClass([
  Property({ name: "direction", type: "text" })
], SyncRun.prototype, "direction", 2);
__decorateClass([
  Property({ name: "status", type: "text" })
], SyncRun.prototype, "status", 2);
__decorateClass([
  Property({ name: "cursor", type: "text", nullable: true })
], SyncRun.prototype, "cursor", 2);
__decorateClass([
  Property({ name: "initial_cursor", type: "text", nullable: true })
], SyncRun.prototype, "initialCursor", 2);
__decorateClass([
  Property({ name: "created_count", type: "int", default: 0 })
], SyncRun.prototype, "createdCount", 2);
__decorateClass([
  Property({ name: "updated_count", type: "int", default: 0 })
], SyncRun.prototype, "updatedCount", 2);
__decorateClass([
  Property({ name: "skipped_count", type: "int", default: 0 })
], SyncRun.prototype, "skippedCount", 2);
__decorateClass([
  Property({ name: "failed_count", type: "int", default: 0 })
], SyncRun.prototype, "failedCount", 2);
__decorateClass([
  Property({ name: "batches_completed", type: "int", default: 0 })
], SyncRun.prototype, "batchesCompleted", 2);
__decorateClass([
  Property({ name: "last_error", type: "text", nullable: true })
], SyncRun.prototype, "lastError", 2);
__decorateClass([
  Property({ name: "progress_job_id", type: "uuid", nullable: true })
], SyncRun.prototype, "progressJobId", 2);
__decorateClass([
  Property({ name: "job_id", type: "text", nullable: true })
], SyncRun.prototype, "jobId", 2);
__decorateClass([
  Property({ name: "triggered_by", type: "text", nullable: true })
], SyncRun.prototype, "triggeredBy", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], SyncRun.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], SyncRun.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], SyncRun.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], SyncRun.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], SyncRun.prototype, "deletedAt", 2);
SyncRun = __decorateClass([
  Entity({ tableName: "sync_runs" }),
  Index({ properties: ["integrationId", "entityType", "status", "organizationId", "tenantId"] })
], SyncRun);
OptionalProps;
let SyncCursor = class {
  constructor() {
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], SyncCursor.prototype, "id", 2);
__decorateClass([
  Property({ name: "integration_id", type: "text" })
], SyncCursor.prototype, "integrationId", 2);
__decorateClass([
  Property({ name: "entity_type", type: "text" })
], SyncCursor.prototype, "entityType", 2);
__decorateClass([
  Property({ name: "direction", type: "text" })
], SyncCursor.prototype, "direction", 2);
__decorateClass([
  Property({ name: "cursor", type: "text", nullable: true })
], SyncCursor.prototype, "cursor", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], SyncCursor.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], SyncCursor.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onCreate: () => /* @__PURE__ */ new Date(), onUpdate: () => /* @__PURE__ */ new Date() })
], SyncCursor.prototype, "updatedAt", 2);
SyncCursor = __decorateClass([
  Entity({ tableName: "sync_cursors" }),
  Index({ properties: ["integrationId", "entityType", "direction", "organizationId", "tenantId"], options: { unique: true } })
], SyncCursor);
OptionalProps;
let SyncMapping = class {
  constructor() {
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], SyncMapping.prototype, "id", 2);
__decorateClass([
  Property({ name: "integration_id", type: "text" })
], SyncMapping.prototype, "integrationId", 2);
__decorateClass([
  Property({ name: "entity_type", type: "text" })
], SyncMapping.prototype, "entityType", 2);
__decorateClass([
  Property({ name: "mapping", type: "json" })
], SyncMapping.prototype, "mapping", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], SyncMapping.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], SyncMapping.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], SyncMapping.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], SyncMapping.prototype, "updatedAt", 2);
SyncMapping = __decorateClass([
  Entity({ tableName: "sync_mappings" }),
  Index({ properties: ["integrationId", "entityType", "organizationId", "tenantId"], options: { unique: true } })
], SyncMapping);
OptionalProps;
let SyncSchedule = class {
  constructor() {
    this.timezone = "UTC";
    this.fullSync = false;
    this.isEnabled = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], SyncSchedule.prototype, "id", 2);
__decorateClass([
  Property({ name: "integration_id", type: "text" })
], SyncSchedule.prototype, "integrationId", 2);
__decorateClass([
  Property({ name: "entity_type", type: "text" })
], SyncSchedule.prototype, "entityType", 2);
__decorateClass([
  Property({ name: "direction", type: "text" })
], SyncSchedule.prototype, "direction", 2);
__decorateClass([
  Property({ name: "schedule_type", type: "text" })
], SyncSchedule.prototype, "scheduleType", 2);
__decorateClass([
  Property({ name: "schedule_value", type: "text" })
], SyncSchedule.prototype, "scheduleValue", 2);
__decorateClass([
  Property({ name: "timezone", type: "text", default: "UTC" })
], SyncSchedule.prototype, "timezone", 2);
__decorateClass([
  Property({ name: "full_sync", type: "boolean", default: false })
], SyncSchedule.prototype, "fullSync", 2);
__decorateClass([
  Property({ name: "is_enabled", type: "boolean", default: true })
], SyncSchedule.prototype, "isEnabled", 2);
__decorateClass([
  Property({ name: "scheduled_job_id", type: "uuid", nullable: true })
], SyncSchedule.prototype, "scheduledJobId", 2);
__decorateClass([
  Property({ name: "last_run_at", type: Date, nullable: true })
], SyncSchedule.prototype, "lastRunAt", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], SyncSchedule.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], SyncSchedule.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], SyncSchedule.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], SyncSchedule.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], SyncSchedule.prototype, "deletedAt", 2);
SyncSchedule = __decorateClass([
  Entity({ tableName: "sync_schedules" }),
  Index({ properties: ["integrationId", "entityType", "direction", "organizationId", "tenantId"] })
], SyncSchedule);
export {
  SyncCursor,
  SyncMapping,
  SyncRun,
  SyncSchedule
};
//# sourceMappingURL=entities.js.map
