generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model afcss_simulations {
  id                          String                        @id
  simulationId                String                        @unique
  simulationType              String
  parameters                  Json
  impactScore                 Decimal?                      @db.Decimal(32, 12)
  simulationResults           Json?
  status                      String                        @default("running")
  startedAt                   DateTime                      @default(now())
  completedAt                 DateTime?
  createdAt                   DateTime                      @default(now())
  updatedAt                   DateTime
  fx_cbdc_ssu_impacts         fx_cbdc_ssu_impacts[]
  multi_asset_contagion_risks multi_asset_contagion_risks[]

  @@index([simulationId])
  @@index([simulationType])
  @@index([status])
}

model ai_autonomous_actions {
  id                           String                       @id
  actionId                     String                       @unique
  charterId                    String
  aiSystem                     String
  actionType                   String
  actionDetails                Json
  authorizationLevel           String
  status                       String                       @default("pending")
  executedAt                   DateTime?
  createdAt                    DateTime                     @default(now())
  updatedAt                    DateTime
  supra_constitutional_charter supra_constitutional_charter @relation(fields: [charterId], references: [id], onDelete: Cascade)

  @@index([actionId])
  @@index([actionType])
  @@index([aiSystem])
  @@index([charterId])
  @@index([status])
}

model aifx_corridors {
  id                    String                @id
  corridorId            String                @unique
  corridorName          String
  originPlanet          String
  destinationPlanet     String
  baseCurrency          String
  quoteCurrency         String
  lagAdjustment         Decimal               @db.Decimal(32, 12)
  gravityFactor         Decimal               @db.Decimal(32, 12)
  radiationRiskSpread   Decimal               @db.Decimal(32, 12)
  velocityNormalization Decimal               @db.Decimal(32, 12)
  status                String                @default("active")
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  aifx_pricing_states   aifx_pricing_states[]
  aifx_trades           aifx_trades[]

  @@index([corridorId])
  @@index([originPlanet, destinationPlanet])
  @@index([status])
}

model aifx_pricing_states {
  id                String         @id
  pricingId         String         @unique
  corridorId        String
  fxPrice           Decimal        @db.Decimal(32, 12)
  liquidityWeight   Decimal        @db.Decimal(32, 12)
  gravityFactor     Decimal        @db.Decimal(32, 12)
  latencyCost       Decimal        @db.Decimal(32, 12)
  timeDilationIndex Decimal        @db.Decimal(32, 12)
  ssuStability      Decimal?       @db.Decimal(32, 12)
  pricingMethod     String
  calculatedAt      DateTime       @default(now())
  createdAt         DateTime       @default(now())
  updatedAt         DateTime
  aifx_corridors    aifx_corridors @relation(fields: [corridorId], references: [id], onDelete: Cascade)

  @@index([calculatedAt])
  @@index([corridorId])
  @@index([pricingId])
}

model aifx_trades {
  id                String          @id
  tradeId           String          @unique
  corridorId        String
  sovereignBankId   String
  baseCurrency      String
  quoteCurrency     String
  amount            Decimal         @db.Decimal(32, 12)
  fxPrice           Decimal         @db.Decimal(32, 12)
  liquidityWeight   Decimal         @db.Decimal(32, 12)
  gravityFactor     Decimal         @db.Decimal(32, 12)
  latencyCost       Decimal         @db.Decimal(32, 12)
  timeDilationIndex Decimal         @db.Decimal(32, 12)
  ssuStability      Decimal?        @db.Decimal(32, 12)
  settlementMode    String
  status            String          @default("pending")
  executedAt        DateTime?
  settledAt         DateTime?
  createdAt         DateTime        @default(now())
  updatedAt         DateTime
  aifx_corridors    aifx_corridors  @relation(fields: [corridorId], references: [id], onDelete: Cascade)
  sovereign_banks   sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([corridorId])
  @@index([executedAt])
  @@index([sovereignBankId])
  @@index([status])
  @@index([tradeId])
}

model alignment_contracts {
  id                    String                @id
  contractId            String                @unique
  parityId              String
  contractType          String
  contractRules         Json
  targetValue           Decimal?              @db.Decimal(32, 12)
  threshold             Decimal?              @db.Decimal(32, 12)
  status                String                @default("active")
  triggeredAt           DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  global_parity_engines global_parity_engines @relation(fields: [parityId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([contractType])
  @@index([parityId])
  @@index([status])
}

model alignment_enforcements {
  id                       String                   @id
  alignmentId              String                   @unique
  deviationId              String
  adjustmentAmount         Decimal                  @db.Decimal(32, 12)
  aligned                  Boolean                  @default(false)
  status                   String                   @default("enforced")
  createdAt                DateTime                 @default(now())
  updatedAt                DateTime
  prime_reality_deviations prime_reality_deviations @relation(fields: [deviationId], references: [id], onDelete: Cascade)

  @@index([alignmentId])
  @@index([deviationId])
  @@index([status])
}

model anchor_integrity_checks {
  id                  String              @id
  checkId             String              @unique
  anchorId            String
  checkType           String
  checkResult         String
  checkDetails        Json?
  status              String              @default("pending")
  checkedAt           DateTime?
  createdAt           DateTime            @default(now())
  updatedAt           DateTime
  holographic_anchors holographic_anchors @relation(fields: [anchorId], references: [id], onDelete: Cascade)

  @@index([anchorId])
  @@index([checkId])
  @@index([checkResult])
  @@index([checkType])
}

model arbitration_decisions {
  id                            String                        @id
  decisionId                    String                        @unique
  arbitrationId                 String
  decisionType                  String
  decisionDetails               Json
  finality                      Boolean                       @default(false)
  msaNotified                   Boolean                       @default(false)
  msaNotificationAt             DateTime?
  status                        String                        @default("pending")
  decidedAt                     DateTime                      @default(now())
  createdAt                     DateTime                      @default(now())
  updatedAt                     DateTime
  quantum_temporal_arbitrations quantum_temporal_arbitrations @relation(fields: [arbitrationId], references: [id], onDelete: Cascade)

  @@index([arbitrationId])
  @@index([decisionId])
  @@index([decisionType])
  @@index([finality])
}

model ari_decisions {
  id               String        @id
  decisionId       String        @unique
  policyId         String?
  decisionType     String
  targetSystem     String
  decisionData     Json
  triggerCondition String
  status           String        @default("pending")
  appliedAt        DateTime?
  reviewedBy       String?
  createdAt        DateTime      @default(now())
  updatedAt        DateTime
  ari_policies     ari_policies? @relation(fields: [policyId], references: [id])

  @@index([decisionId])
  @@index([decisionType])
  @@index([policyId])
  @@index([status])
  @@index([targetSystem])
}

model ari_policies {
  id                 String               @id
  policyId           String               @unique
  policyType         String
  policyName         String
  policyRules        Json
  layer              String
  status             String               @default("active")
  effectiveDate      DateTime
  expiryDate         DateTime?
  createdBy          String               @default("ari")
  createdAt          DateTime             @default(now())
  updatedAt          DateTime
  ari_decisions      ari_decisions[]
  ari_policy_updates ari_policy_updates[]

  @@index([layer])
  @@index([policyId])
  @@index([policyType])
  @@index([status])
}

model ari_policy_updates {
  id            String       @id
  updateId      String       @unique
  policyId      String
  updateType    String
  previousRules Json?
  newRules      Json
  reason        String
  updatedBy     String       @default("ari")
  reviewWindow  DateTime?
  caaOverride   Boolean      @default(false)
  status        String       @default("pending")
  createdAt     DateTime     @default(now())
  updatedAt     DateTime
  ari_policies  ari_policies @relation(fields: [policyId], references: [id], onDelete: Cascade)

  @@index([policyId])
  @@index([status])
  @@index([updateId])
  @@index([updateType])
}

model asset_reconciliations {
  id                    String               @id
  reconciliationId      String               @unique
  assetId               String
  reconciliationType    String
  beforeState           Json
  afterState            Json
  reconciliationDetails Json?
  status                String               @default("pending")
  reconciledAt          DateTime?
  createdAt             DateTime             @default(now())
  updatedAt             DateTime
  superposition_assets  superposition_assets @relation(fields: [assetId], references: [id], onDelete: Cascade)

  @@index([assetId])
  @@index([reconciliationId])
  @@index([status])
}

model asset_valuations {
  id                   String               @id
  valuationId          String               @unique
  assetId              String
  stateIndex           Int?
  stateValue           Decimal              @db.Decimal(32, 12)
  probability          Decimal              @db.Decimal(32, 12)
  weightedValue        Decimal              @db.Decimal(32, 12)
  valuationTime        DateTime             @default(now())
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  superposition_assets superposition_assets @relation(fields: [assetId], references: [id], onDelete: Cascade)

  @@index([assetId])
  @@index([stateIndex])
  @@index([valuationId])
}

model atomic_settlements {
  id                  String    @id
  settlementId        String    @unique
  transactionId       String?
  sourceBankId        String
  destinationBankId   String
  amount              Decimal   @db.Decimal(32, 8)
  currencyCode        String
  assetType           String
  settlementMode      String
  dualLedgerCommit    Boolean   @default(false)
  sovereignLedgerHash String?
  dbisLedgerHash      String?
  settlementTime      Int?
  status              String    @default("pending")
  committedAt         DateTime?
  settledAt           DateTime?
  createdAt           DateTime  @default(now())
  updatedAt           DateTime

  @@index([committedAt])
  @@index([destinationBankId])
  @@index([settlementId])
  @@index([sourceBankId])
  @@index([status])
  @@index([transactionId])
}

model audit_logs {
  id         String   @id
  eventType  String
  entityType String
  entityId   String
  action     String
  actorId    String?
  actorType  String?
  details    Json?
  timestamp  DateTime @default(now())
  ipAddress  String?
  userAgent  String?

  @@index([entityType, entityId])
  @@index([eventType])
  @@index([timestamp])
}

model autonomous_liquidity_actions {
  id              String    @id
  actionId        String    @unique
  actionType      String
  sovereignBankId String
  amount          Decimal   @db.Decimal(32, 8)
  currencyCode    String?
  triggerReason   String
  executedAt      DateTime?
  status          String    @default("PENDING")
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([actionId])
  @@index([actionType])
  @@index([sovereignBankId])
  @@index([status])
}

model avatar_bond_coupons {
  id                  String              @id
  couponId            String              @unique
  bondId              String
  couponAmount        Decimal             @db.Decimal(32, 8)
  paymentDate         DateTime
  status              String              @default("pending")
  paidAt              DateTime?
  createdAt           DateTime            @default(now())
  updatedAt           DateTime
  avatar_linked_bonds avatar_linked_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([couponId])
  @@index([status])
}

model avatar_linked_bonds {
  id                      String                @id
  bondId                  String                @unique
  bondName                String
  principalAmount         Decimal               @db.Decimal(32, 8)
  avatarId                String
  metaverseNodeId         String?
  digitalIdentityId       String
  metaverseAssetPortfolio Json?
  maturityDate            DateTime
  couponRate              Decimal               @db.Decimal(32, 8)
  status                  String                @default("active")
  issuedAt                DateTime              @default(now())
  createdAt               DateTime              @default(now())
  updatedAt               DateTime
  avatar_bond_coupons     avatar_bond_coupons[]

  @@index([avatarId])
  @@index([bondId])
  @@index([digitalIdentityId])
  @@index([metaverseNodeId])
  @@index([status])
}

model bank_accounts {
  id                                                           String           @id
  accountNumber                                                String           @unique
  sovereignBankId                                              String
  accountType                                                  String
  currencyCode                                                 String
  assetType                                                    String           @default("fiat")
  balance                                                      Decimal          @default(0) @db.Decimal(32, 8)
  availableBalance                                             Decimal          @default(0) @db.Decimal(32, 8)
  reservedBalance                                              Decimal          @default(0) @db.Decimal(32, 8)
  reserveRequirement                                           Decimal?         @db.Decimal(32, 8)
  status                                                       String           @default("active")
  createdAt                                                    DateTime         @default(now())
  updatedAt                                                    DateTime
  sovereign_banks                                              sovereign_banks  @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
  ledger_entries_ledger_entries_creditAccountIdTobank_accounts ledger_entries[] @relation("ledger_entries_creditAccountIdTobank_accounts")
  ledger_entries_ledger_entries_debitAccountIdTobank_accounts  ledger_entries[] @relation("ledger_entries_debitAccountIdTobank_accounts")

  @@index([accountNumber])
  @@index([accountType])
  @@index([currencyCode])
  @@index([sovereignBankId])
}

model behavioral_fields {
  id              String   @id
  fieldId         String   @unique
  sovereignBankId String
  fieldData       Json
  influenceScore  Decimal  @db.Decimal(32, 12)
  status          String   @default("active")
  createdAt       DateTime @default(now())
  updatedAt       DateTime

  @@index([fieldId])
  @@index([sovereignBankId])
  @@index([status])
}

model behavioral_incentives {
  id              String    @id
  incentiveId     String    @unique
  entityId        String
  entityType      String
  incentiveType   String
  incentiveAmount Decimal   @db.Decimal(32, 8)
  incentiveReason String
  status          String    @default("pending")
  appliedAt       DateTime?
  expiresAt       DateTime?
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([entityId])
  @@index([entityType])
  @@index([incentiveId])
  @@index([incentiveType])
  @@index([status])
}

model behavioral_metrics {
  id           String   @id
  metricId     String   @unique
  entityId     String
  entityType   String
  metricType   String
  metricValue  Decimal  @db.Decimal(32, 12)
  metricData   Json?
  calculatedAt DateTime @default(now())
  createdAt    DateTime @default(now())
  updatedAt    DateTime

  @@index([calculatedAt])
  @@index([entityId])
  @@index([entityType])
  @@index([metricId])
  @@index([metricType])
}

model behavioral_penalties {
  id                 String    @id
  penaltyId          String    @unique
  entityId           String
  entityType         String
  penaltyType        String
  penaltyAmount      Decimal?  @db.Decimal(32, 8)
  penaltyReason      String
  riskScore          Decimal   @db.Decimal(32, 12)
  threshold          Decimal   @db.Decimal(32, 12)
  predictiveContract Json?
  status             String    @default("pending")
  appliedAt          DateTime?
  resolvedAt         DateTime?
  createdAt          DateTime  @default(now())
  updatedAt          DateTime

  @@index([entityId])
  @@index([entityType])
  @@index([penaltyId])
  @@index([penaltyType])
  @@index([status])
}

model behavioral_profiles {
  id              String   @id
  profileId       String   @unique
  entityId        String
  entityType      String
  ccvScore        Decimal? @db.Decimal(32, 12)
  ilbScore        Decimal? @db.Decimal(32, 12)
  srpScore        Decimal? @db.Decimal(32, 12)
  behaviorPattern Json?
  riskLevel       String   @default("low")
  status          String   @default("active")
  lastUpdated     DateTime @default(now())
  createdAt       DateTime @default(now())
  updatedAt       DateTime

  @@index([entityId])
  @@index([entityType])
  @@index([profileId])
  @@index([riskLevel])
  @@index([status])
}

model bond_compliance_records {
  id                    String                @id
  recordId              String                @unique
  assessmentId          String
  complianceType        String
  complianceStatus      String                @default("compliant")
  violationType         String?
  violationDetails      Json?
  ariAction             String?
  resolvedAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  bond_risk_assessments bond_risk_assessments @relation(fields: [assessmentId], references: [id], onDelete: Cascade)

  @@index([assessmentId])
  @@index([complianceStatus])
  @@index([complianceType])
  @@index([recordId])
}

model bond_coupon_payments {
  id                  String        @id
  paymentId           String        @unique
  bondId              String
  couponAmount        Decimal       @db.Decimal(32, 8)
  currencyCode        String
  paymentDate         DateTime
  settlementMode      String        @default("cbdc")
  sovereignLedgerHash String?
  dbisLedgerHash      String?
  dualLedgerCommit    Boolean       @default(false)
  status              String        @default("pending")
  settledAt           DateTime?
  createdAt           DateTime      @default(now())
  updatedAt           DateTime
  digital_bonds       digital_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([paymentDate])
  @@index([paymentId])
  @@index([status])
}

model bond_market_integrations {
  id                 String    @id
  integrationId      String    @unique
  integrationType    String
  externalSystemId   String
  externalSystemName String
  integrationStatus  String    @default("active")
  lastSyncAt         DateTime?
  syncFrequency      String    @default("real_time")
  integrationConfig  Json?
  createdAt          DateTime  @default(now())
  updatedAt          DateTime

  @@index([integrationId])
  @@index([integrationStatus])
  @@index([integrationType])
}

model bond_market_listings {
  id               String           @id
  listingId        String           @unique
  marketId         String
  bondId           String?
  syntheticBondId  String?
  listingType      String
  listingPrice     Decimal?         @db.Decimal(32, 12)
  quantity         Decimal?         @db.Decimal(32, 8)
  status           String           @default("active")
  listedAt         DateTime         @default(now())
  filledAt         DateTime?
  createdAt        DateTime         @default(now())
  updatedAt        DateTime
  gru_bond_markets gru_bond_markets @relation(fields: [marketId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([listingId])
  @@index([marketId])
  @@index([status])
  @@index([syntheticBondId])
}

model bond_market_participants {
  id               String           @id
  participantId    String           @unique
  marketId         String
  sovereignBankId  String?
  participantType  String
  participantName  String
  accessLevel      String
  status           String           @default("active")
  approvedAt       DateTime?
  createdAt        DateTime         @default(now())
  updatedAt        DateTime
  gru_bond_markets gru_bond_markets @relation(fields: [marketId], references: [id], onDelete: Cascade)
  sovereign_banks  sovereign_banks? @relation(fields: [sovereignBankId], references: [id])

  @@index([marketId])
  @@index([participantId])
  @@index([participantType])
  @@index([sovereignBankId])
  @@index([status])
}

model bond_order_books {
  id                String    @id
  orderId           String    @unique
  bondId            String
  orderType         String
  price             Decimal   @db.Decimal(32, 12)
  quantity          Decimal   @db.Decimal(32, 8)
  participantBankId String
  priority          Int
  status            String    @default("pending")
  placedAt          DateTime  @default(now())
  matchedAt         DateTime?
  createdAt         DateTime  @default(now())
  updatedAt         DateTime

  @@index([bondId])
  @@index([orderId])
  @@index([orderType])
  @@index([priority])
  @@index([status])
}

model bond_pricing_history {
  id                  String               @id
  historyId           String               @unique
  bondId              String?
  syntheticBondId     String?
  price               Decimal              @db.Decimal(32, 12)
  yield               Decimal?             @db.Decimal(32, 12)
  volume              Decimal?             @db.Decimal(32, 8)
  timestamp           DateTime             @default(now())
  createdAt           DateTime             @default(now())
  gru_bonds           gru_bonds?           @relation(fields: [bondId], references: [bondId])
  synthetic_gru_bonds synthetic_gru_bonds? @relation(fields: [syntheticBondId], references: [syntheticBondId])

  @@index([bondId])
  @@index([historyId])
  @@index([syntheticBondId])
  @@index([timestamp])
}

model bond_risk_assessments {
  id                       String                    @id
  assessmentId             String                    @unique
  bondId                   String?
  syntheticBondId          String?
  assessmentType           String
  sovereignDefaultExposure Decimal?                  @db.Decimal(32, 8)
  fxLinkedRisk             Decimal?                  @db.Decimal(32, 8)
  metalIndexDependency     Decimal?                  @db.Decimal(32, 8)
  creditRisk               Decimal?                  @db.Decimal(32, 8)
  marketRisk               Decimal?                  @db.Decimal(32, 8)
  liquidityRisk            Decimal?                  @db.Decimal(32, 8)
  operationalRisk          Decimal?                  @db.Decimal(32, 8)
  compositeRiskScore       Decimal                   @db.Decimal(32, 8)
  riskTier                 String
  sareScore                Decimal?                  @db.Decimal(32, 8)
  ariCompliance            Boolean                   @default(true)
  assessmentDetails        Json?
  assessedAt               DateTime                  @default(now())
  createdAt                DateTime                  @default(now())
  updatedAt                DateTime
  bond_compliance_records  bond_compliance_records[]
  gru_bonds                gru_bonds?                @relation(fields: [bondId], references: [bondId])
  synthetic_gru_bonds      synthetic_gru_bonds?      @relation(fields: [syntheticBondId], references: [syntheticBondId])

  @@index([assessedAt])
  @@index([assessmentId])
  @@index([assessmentType])
  @@index([bondId])
  @@index([riskTier])
  @@index([syntheticBondId])
}

model bond_settlement_pipelines {
  id                   String               @id
  pipelineId           String               @unique
  settlementId         String
  stage                String
  stageStatus          String               @default("pending")
  stageData            Json?
  errorMessage         String?
  startedAt            DateTime?
  completedAt          DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  gru_bond_settlements gru_bond_settlements @relation(fields: [settlementId], references: [settlementId], onDelete: Cascade)

  @@index([pipelineId])
  @@index([settlementId])
  @@index([stageStatus])
  @@index([stage])
}

model bond_trades {
  id            String        @id
  tradeId       String        @unique
  bondId        String
  buyerBankId   String
  sellerBankId  String
  quantity      Decimal       @db.Decimal(32, 8)
  price         Decimal       @db.Decimal(32, 12)
  tradeAmount   Decimal       @db.Decimal(32, 8)
  settlementId  String?
  status        String        @default("pending")
  tradedAt      DateTime      @default(now())
  settledAt     DateTime?
  createdAt     DateTime      @default(now())
  updatedAt     DateTime
  digital_bonds digital_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([buyerBankId])
  @@index([sellerBankId])
  @@index([status])
  @@index([tradeId])
}

model caso_optimizations {
  id                 String      @id
  optimizationId     String      @unique
  routeId            String
  optimizationType   String
  inputParameters    Json
  optimizationResult Json
  status             String      @default("pending")
  calculatedAt       DateTime    @default(now())
  appliedAt          DateTime?
  createdAt          DateTime    @default(now())
  updatedAt          DateTime
  caso_routes        caso_routes @relation(fields: [routeId], references: [id], onDelete: Cascade)

  @@index([optimizationId])
  @@index([optimizationType])
  @@index([routeId])
  @@index([status])
}

model caso_routes {
  id                 String               @id
  routeId            String               @unique
  sourceBankId       String
  destinationBankId  String
  currencyCode       String
  assetType          String
  fxCost             Decimal              @db.Decimal(32, 12)
  liquidityPenalty   Decimal              @db.Decimal(32, 12)
  volatilityRisk     Decimal              @db.Decimal(32, 12)
  sriFactor          Decimal              @db.Decimal(32, 12)
  ssuCost            Decimal              @db.Decimal(32, 12)
  totalCost          Decimal              @db.Decimal(32, 12)
  routePath          Json
  status             String               @default("active")
  createdAt          DateTime             @default(now())
  updatedAt          DateTime
  caso_optimizations caso_optimizations[]

  @@index([destinationBankId])
  @@index([routeId])
  @@index([sourceBankId])
  @@index([status])
}

model causal_resolutions {
  id                        String                    @id
  resolutionId              String                    @unique
  tcxId                     String
  resolutionType            String
  resolutionMapping         Json
  resolutionResult          Json?
  status                    String                    @default("pending")
  appliedAt                 DateTime?
  createdAt                 DateTime                  @default(now())
  updatedAt                 DateTime
  trans_causal_transactions trans_causal_transactions @relation(fields: [tcxId], references: [id], onDelete: Cascade)

  @@index([resolutionId])
  @@index([resolutionType])
  @@index([status])
  @@index([tcxId])
}

model cbdc_compliance_boards {
  id               String   @id
  boardId          String   @unique
  boardName        String   @default("CBDC Compliance & Enforcement Board")
  memberCount      Int?
  enforcementLevel String
  status           String   @default("active")
  createdAt        DateTime @default(now())
  updatedAt        DateTime

  @@index([boardId])
  @@index([status])
}

model cbdc_issuance {
  id               String          @id
  recordId         String          @unique
  sovereignBankId  String
  walletId         String?
  amountMinted     Decimal         @default(0) @db.Decimal(32, 8)
  amountBurned     Decimal         @default(0) @db.Decimal(32, 8)
  netChange        Decimal         @default(0) @db.Decimal(32, 8)
  operationType    String
  operatorIdentity String
  reserveBacking   Decimal?        @db.Decimal(32, 8)
  timestampUtc     DateTime        @default(now())
  metadata         Json?
  sovereign_banks  sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([sovereignBankId])
  @@index([timestampUtc])
  @@index([walletId])
}

model cbdc_liquidity_windows {
  id                 String    @id
  windowId           String    @unique
  sovereignBankId    String
  windowType         String
  availableLiquidity Decimal   @db.Decimal(32, 8)
  swapRate           Decimal?  @db.Decimal(32, 12)
  status             String    @default("open")
  openedAt           DateTime  @default(now())
  closedAt           DateTime?
  createdAt          DateTime  @default(now())
  updatedAt          DateTime

  @@index([sovereignBankId])
  @@index([status])
  @@index([windowId])
  @@index([windowType])
}

model cbdc_monetary_committees {
  id                     String                   @id
  committeeId            String                   @unique
  sovereignBankId        String
  committeeName          String
  memberCount            Int?
  votingMechanism        String
  status                 String                   @default("active")
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  cbdc_supply_controls   cbdc_supply_controls[]
  cbdc_velocity_controls cbdc_velocity_controls[]

  @@index([committeeId])
  @@index([sovereignBankId])
  @@index([status])
}

model cbdc_monetary_simulations {
  id                String    @id
  simulationId      String    @unique
  sovereignBankId   String?
  simulationType    String
  supplyChange      Decimal?  @db.Decimal(32, 8)
  velocityFactor    Decimal?  @db.Decimal(32, 12)
  fxReserveStrength Decimal?  @db.Decimal(32, 12)
  impactScore       Decimal?  @db.Decimal(32, 12)
  simulationResults Json?
  status            String    @default("running")
  startedAt         DateTime  @default(now())
  completedAt       DateTime?
  createdAt         DateTime  @default(now())
  updatedAt         DateTime

  @@index([simulationId])
  @@index([simulationType])
  @@index([sovereignBankId])
  @@index([status])
}

model cbdc_offline_capsules {
  id               String    @id
  capsuleId        String    @unique
  senderWalletId   String
  receiverWalletId String
  amount           Decimal   @db.Decimal(32, 8)
  timestamp        DateTime
  expiryWindow     Int
  doubleSpendToken String    @unique
  signature        String
  status           String    @default("pending")
  syncedAt         DateTime?
  createdAt        DateTime  @default(now())

  @@index([capsuleId])
  @@index([doubleSpendToken])
  @@index([status])
}

model cbdc_sub_ledger {
  id             String   @id
  ledgerEntryId  String   @unique
  cbdcIssuanceId String
  walletId       String?
  operationType  String
  amount         Decimal  @db.Decimal(32, 8)
  createdAt      DateTime @default(now())

  @@index([cbdcIssuanceId])
  @@index([walletId])
}

model cbdc_supply_controls {
  id                       String                    @id
  controlId                String                    @unique
  committeeId              String?
  sovereignBankId          String
  operationType            String
  amount                   Decimal                   @db.Decimal(32, 8)
  dualSignature1           String?
  dualSignature2           String?
  stressAdjustedCap        Decimal?                  @db.Decimal(32, 8)
  status                   String                    @default("pending")
  approvedAt               DateTime?
  executedAt               DateTime?
  createdAt                DateTime                  @default(now())
  updatedAt                DateTime
  cbdc_monetary_committees cbdc_monetary_committees? @relation(fields: [committeeId], references: [id])

  @@index([committeeId])
  @@index([controlId])
  @@index([operationType])
  @@index([sovereignBankId])
  @@index([status])
}

model cbdc_velocity_controls {
  id                       String                    @id
  controlId                String                    @unique
  committeeId              String?
  sovereignBankId          String
  walletId                 String?
  walletLevelLimit         Decimal?                  @db.Decimal(32, 8)
  spendingCategory         String?
  timeBasedThrottle        Json?
  status                   String                    @default("active")
  effectiveDate            DateTime
  expiryDate               DateTime?
  createdAt                DateTime                  @default(now())
  updatedAt                DateTime
  cbdc_monetary_committees cbdc_monetary_committees? @relation(fields: [committeeId], references: [id])

  @@index([committeeId])
  @@index([controlId])
  @@index([sovereignBankId])
  @@index([status])
  @@index([walletId])
}

model cbdc_wallets {
  id              String   @id
  walletId        String   @unique
  sovereignBankId String
  walletType      String
  currencyCode    String
  balance         Decimal  @default(0) @db.Decimal(32, 8)
  status          String   @default("active")
  tieredAccess    Json?
  createdAt       DateTime @default(now())
  updatedAt       DateTime

  @@index([sovereignBankId])
  @@index([walletType])
}

model cdt_transactions {
  id                       String                   @id
  transactionId            String                   @unique
  cdtId                    String
  transactionType          String
  sourceBankId             String?
  destinationBankId        String?
  targetAssetType          String?
  targetAssetId            String?
  amount                   Decimal                  @db.Decimal(32, 8)
  status                   String                   @default("pending")
  completedAt              DateTime?
  createdAt                DateTime                 @default(now())
  updatedAt                DateTime
  commodity_digital_tokens commodity_digital_tokens @relation(fields: [cdtId], references: [id], onDelete: Cascade)

  @@index([cdtId])
  @@index([status])
  @@index([transactionId])
  @@index([transactionType])
}

model chain_headers {
  id                      String                  @id
  headerId                String                  @unique
  settlementId            String
  chainType               String
  chainId                 String
  blockNumber             String?
  blockHash               String
  previousBlockHash       String?
  timestamp               DateTime
  verificationStatus      String                  @default("pending")
  verifiedAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  cross_chain_settlements cross_chain_settlements @relation(fields: [settlementId], references: [id], onDelete: Cascade)

  @@index([blockHash])
  @@index([chainType])
  @@index([headerId])
  @@index([settlementId])
  @@index([verificationStatus])
}

/// This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model chart_of_accounts {
  id                      String              @id @db.VarChar(36)
  account_code            String              @unique @db.VarChar(10)
  account_name            String              @db.VarChar(255)
  category                String              @db.VarChar(20)
  parent_account_code     String?             @db.VarChar(10)
  level                   Int
  normal_balance          String              @db.VarChar(6)
  account_type            String?             @db.VarChar(100)
  usgaap_classification   String?             @db.VarChar(255)
  ifrs_classification     String?             @db.VarChar(255)
  description             String?
  is_active               Boolean?            @default(true)
  is_system_account       Boolean?            @default(false)
  metadata                Json?
  created_at              DateTime?           @default(now()) @db.Timestamp(6)
  updated_at              DateTime?           @default(now()) @db.Timestamp(6)
  chart_of_accounts       chart_of_accounts?  @relation("chart_of_accountsTochart_of_accounts", fields: [parent_account_code], references: [account_code], onDelete: Restrict, onUpdate: NoAction)
  other_chart_of_accounts chart_of_accounts[] @relation("chart_of_accountsTochart_of_accounts")

  @@index([is_active], map: "idx_chart_of_accounts_active")
  @@index([category], map: "idx_chart_of_accounts_category")
  @@index([ifrs_classification], map: "idx_chart_of_accounts_ifrs")
  @@index([level], map: "idx_chart_of_accounts_level")
  @@index([parent_account_code], map: "idx_chart_of_accounts_parent")
  @@index([usgaap_classification], map: "idx_chart_of_accounts_usgaap")
}

model charter_articles {
  id                           String                       @id
  articleId                    String                       @unique
  charterId                    String
  articleNumber                Int
  title                        String
  content                      String
  principleType                String?
  enforcementLevel             String                       @default("mandatory")
  status                       String                       @default("active")
  createdAt                    DateTime                     @default(now())
  updatedAt                    DateTime
  supra_constitutional_charter supra_constitutional_charter @relation(fields: [charterId], references: [id], onDelete: Cascade)

  @@index([articleId])
  @@index([articleNumber])
  @@index([charterId])
  @@index([principleType])
}

model chrono_settlements {
  id                                                                    String                     @id
  settlementId                                                          String                     @unique
  sourceBankId                                                          String
  destinationBankId                                                     String
  amount                                                                Decimal                    @db.Decimal(32, 8)
  currencyCode                                                          String
  assetType                                                             String
  timeDomain                                                            String
  timeOffset                                                            Decimal                    @db.Decimal(32, 12)
  status                                                                String                     @default("pre_commit")
  preCommittedAt                                                        DateTime?
  committedAt                                                           DateTime?
  reconciledAt                                                          DateTime?
  settledAt                                                             DateTime?
  createdAt                                                             DateTime                   @default(now())
  updatedAt                                                             DateTime
  sovereign_banks_chrono_settlements_destinationBankIdTosovereign_banks sovereign_banks            @relation("chrono_settlements_destinationBankIdTosovereign_banks", fields: [destinationBankId], references: [id], onDelete: Cascade)
  sovereign_banks_chrono_settlements_sourceBankIdTosovereign_banks      sovereign_banks            @relation("chrono_settlements_sourceBankIdTosovereign_banks", fields: [sourceBankId], references: [id], onDelete: Cascade)
  temporal_pre_commits                                                  temporal_pre_commits[]
  temporal_reconciliations                                              temporal_reconciliations[]

  @@index([destinationBankId])
  @@index([settlementId])
  @@index([sourceBankId])
  @@index([status])
}

model cim_contract_templates {
  id              String    @id
  templateId      String    @unique
  templateCode    String
  templateName    String
  templateType    String
  contractLogic   Json
  validationRules Json
  status          String    @default("active")
  version         Int       @default(1)
  effectiveDate   DateTime
  expiryDate      DateTime?
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([status])
  @@index([templateCode])
  @@index([templateId])
  @@index([templateType])
}

model cim_identity_mappings {
  id                     String   @id
  mappingId              String   @unique
  sourceSovereignBankId  String
  targetSovereignBankId  String
  sourceIdentityId       String
  targetIdentityId       String
  identityType           String
  certificationLevel     String
  crossCertificationHash String?
  status                 String   @default("active")
  createdAt              DateTime @default(now())
  updatedAt              DateTime

  @@index([identityType])
  @@index([mappingId])
  @@index([sourceSovereignBankId])
  @@index([targetSovereignBankId])
}

model cim_interledger_conversions {
  id                    String    @id
  conversionId          String    @unique
  sourceSovereignBankId String
  targetSovereignBankId String
  sourceCbdcCode        String
  targetCbdcCode        String
  amount                Decimal   @db.Decimal(32, 8)
  fxRate                Decimal?  @db.Decimal(32, 12)
  conversionType        String
  dualPostingStatus     String    @default("pending")
  scbLedgerHash         String?
  dbisLedgerHash        String?
  status                String    @default("pending")
  completedAt           DateTime?
  createdAt             DateTime  @default(now())
  updatedAt             DateTime

  @@index([conversionId])
  @@index([sourceSovereignBankId])
  @@index([status])
  @@index([targetSovereignBankId])
}

model cim_offline_capsules {
  id                        String    @id
  capsuleId                 String    @unique
  sourceSovereignBankId     String
  targetSovereignBankId     String
  senderWalletId            String
  receiverWalletId          String
  amount                    Decimal   @db.Decimal(32, 8)
  timestamp                 DateTime
  expiryWindow              Int
  doubleSpendToken          String    @unique
  signature                 String
  crossSovereignRecognition Boolean   @default(false)
  globalSyncStatus          String    @default("pending")
  syncedAt                  DateTime?
  createdAt                 DateTime  @default(now())
  updatedAt                 DateTime

  @@index([capsuleId])
  @@index([doubleSpendToken])
  @@index([globalSyncStatus])
  @@index([sourceSovereignBankId])
  @@index([targetSovereignBankId])
}

model classical_interfaces {
  id                    String                @id
  interfaceId           String                @unique
  ledgerId              String
  connectionType        String
  connectionString      String
  stateSnapshot         Json?
  status                String                @default("active")
  lastSyncAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  multi_reality_ledgers multi_reality_ledgers @relation(fields: [ledgerId], references: [id], onDelete: Cascade)

  @@index([interfaceId])
  @@index([ledgerId])
  @@index([status])
}

model cognitive_contracts {
  id                   String               @id
  contractId           String               @unique
  stateId              String
  threshold            Decimal              @db.Decimal(32, 12)
  action               String
  parameters           Json?
  cognitiveAlignment   Decimal              @db.Decimal(32, 12)
  executionStatus      String               @default("pending_execution")
  executedAt           DateTime?
  status               String               @default("active")
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  consciousness_states consciousness_states @relation(fields: [stateId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([executionStatus])
  @@index([stateId])
  @@index([status])
}

model collateral_haircuts {
  id            String    @id
  haircutId     String    @unique
  assetType     String
  haircutRate   Decimal   @db.Decimal(32, 12)
  effectiveDate DateTime
  expiryDate    DateTime?
  status        String    @default("active")
  createdAt     DateTime  @default(now())
  updatedAt     DateTime

  @@index([assetType])
  @@index([haircutId])
  @@index([status])
}

model collateral_liquidities {
  id              String    @id
  liquidityId     String    @unique
  assetType       String
  liquidityWeight Decimal   @db.Decimal(32, 12)
  liquidityScore  Decimal?  @db.Decimal(32, 8)
  effectiveDate   DateTime
  expiryDate      DateTime?
  status          String    @default("active")
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([assetType])
  @@index([liquidityId])
  @@index([status])
}

model collateral_optimizations {
  id                      String                  @id
  optimizationId          String                  @unique
  collateralId            String
  optimizationType        String
  optimalAllocation       Json
  totalCost               Decimal                 @db.Decimal(32, 12)
  calculationMethod       String
  status                  String                  @default("pending")
  calculatedAt            DateTime                @default(now())
  appliedAt               DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  multi_asset_collaterals multi_asset_collaterals @relation(fields: [collateralId], references: [id], onDelete: Cascade)

  @@index([collateralId])
  @@index([optimizationId])
  @@index([optimizationType])
  @@index([status])
}

model collateral_sub_ledger {
  id             String   @id
  ledgerEntryId  String   @unique
  collateralType String
  pledgedAmount  Decimal  @db.Decimal(32, 8)
  valuation      Decimal  @db.Decimal(32, 12)
  createdAt      DateTime @default(now())
}

model commodities {
  id            String   @id
  commodityType String
  unit          String
  spotPrice     Decimal  @db.Decimal(32, 12)
  priceSource   String
  lastUpdated   DateTime @default(now())
  updatedAt     DateTime

  @@unique([commodityType, unit])
  @@index([commodityType])
}

model commodities_sub_ledger {
  id            String   @id
  ledgerEntryId String   @unique
  commodityType String
  quantity      Decimal  @db.Decimal(32, 8)
  unit          String
  price         Decimal? @db.Decimal(32, 12)
  createdAt     DateTime @default(now())

  @@index([commodityType])
}

model commodity_custodians {
  id                             String                           @id
  custodianId                    String                           @unique
  custodianName                  String
  entityType                     String
  approvalStatus                 String                           @default("pending")
  approvalDate                   DateTime?
  commoditiesHandled             Json
  createdAt                      DateTime                         @default(now())
  updatedAt                      DateTime
  commodity_digital_tokens       commodity_digital_tokens[]
  commodity_reserve_certificates commodity_reserve_certificates[]

  @@index([custodianId])
}

model commodity_digital_tokens {
  id                             String                         @id
  cdtId                          String                         @unique
  commodityType                  String
  weight                         Decimal                        @db.Decimal(32, 8)
  unit                           String
  reserveCertificateId           String
  custodianId                    String
  sovereignIssuerId              String
  timestamp                      DateTime                       @default(now())
  signature                      String
  status                         String                         @default("active")
  createdAt                      DateTime                       @default(now())
  updatedAt                      DateTime
  cdt_transactions               cdt_transactions[]
  commodity_custodians           commodity_custodians           @relation(fields: [custodianId], references: [id])
  commodity_reserve_certificates commodity_reserve_certificates @relation(fields: [reserveCertificateId], references: [id])

  @@index([cdtId])
  @@index([commodityType])
  @@index([custodianId])
  @@index([reserveCertificateId])
  @@index([status])
}

model commodity_reserve_certificates {
  id                       String                     @id
  certificateId            String                     @unique
  commodityType            String
  quantity                 Decimal                    @db.Decimal(32, 8)
  unit                     String
  custodianId              String
  certificateHash          String
  verificationStatus       String                     @default("pending")
  auditDate                DateTime?
  nextAuditDate            DateTime?
  createdAt                DateTime                   @default(now())
  updatedAt                DateTime
  commodity_digital_tokens commodity_digital_tokens[]
  commodity_custodians     commodity_custodians       @relation(fields: [custodianId], references: [id])

  @@index([certificateHash])
  @@index([certificateId])
  @@index([custodianId])
  @@index([verificationStatus])
}

model compliance_records {
  id              String          @id
  sovereignBankId String
  transactionId   String?
  recordType      String
  entityName      String?
  entityType      String?
  riskScore       Int             @default(0)
  status          String          @default("clear")
  screeningResult Json?
  createdAt       DateTime        @default(now())
  updatedAt       DateTime
  sovereign_banks sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([recordType])
  @@index([sovereignBankId])
  @@index([status])
  @@index([transactionId])
}

model compliance_sandboxes {
  id              String    @id
  sandboxId       String    @unique
  sovereignBankId String
  scenarioType    String
  scenarioName    String
  scenarioConfig  Json
  testResults     Json?
  status          String    @default("draft")
  startedAt       DateTime?
  completedAt     DateTime?
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([sandboxId])
  @@index([scenarioType])
  @@index([sovereignBankId])
  @@index([status])
}

model compute_tasks {
  id                String     @id
  taskId            String     @unique
  nodeId            String
  taskType          String
  taskPayload       Json
  computeCost       Decimal?   @db.Decimal(32, 8)
  latency           Int?
  distributionScore Decimal?   @db.Decimal(32, 8)
  status            String     @default("pending")
  assignedAt        DateTime   @default(now())
  startedAt         DateTime?
  completedAt       DateTime?
  result            Json?
  createdAt         DateTime   @default(now())
  updatedAt         DateTime
  dscm_nodes        dscm_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([nodeId])
  @@index([status])
  @@index([taskId])
  @@index([taskType])
}

model consciousness_states {
  id                     String                @id
  stateId                String                @unique
  agentId                String
  stateHash              String
  cognitiveIntent        String
  transactionHistory     String[]
  sovereignBehaviorField String
  influenceLevel         Decimal               @db.Decimal(32, 12)
  status                 String                @default("active")
  createdAt              DateTime              @default(now())
  updatedAt              DateTime
  cognitive_contracts    cognitive_contracts[]

  @@index([agentId])
  @@index([stateHash])
  @@index([stateId])
  @@index([status])
}

model consistency_rollbacks {
  id                            String                        @id
  rollbackId                    String                        @unique
  arbitrationId                 String
  targetState                   Json
  rollbackReason                String
  rollbackScope                 Json
  status                        String                        @default("pending")
  executedAt                    DateTime?
  createdAt                     DateTime                      @default(now())
  updatedAt                     DateTime
  quantum_temporal_arbitrations quantum_temporal_arbitrations @relation(fields: [arbitrationId], references: [id], onDelete: Cascade)

  @@index([arbitrationId])
  @@index([rollbackId])
  @@index([status])
}

model consolidated_statements {
  id            String    @id
  statementId   String    @unique
  statementType String
  reportDate    DateTime
  periodStart   DateTime
  periodEnd     DateTime
  status        String    @default("draft")
  statementData Json
  publishedAt   DateTime?
  createdAt     DateTime  @default(now())
  updatedAt     DateTime

  @@index([reportDate])
  @@index([statementId])
  @@index([statementType])
  @@index([status])
}

model constitution_articles {
  id            String    @id
  articleNumber String
  articleTitle  String
  section       String?
  content       String
  version       Int       @default(1)
  effectiveDate DateTime
  expiryDate    DateTime?
  status        String    @default("active")
  metadata      Json?
  createdAt     DateTime  @default(now())
  updatedAt     DateTime

  @@index([articleNumber])
  @@index([status])
  @@index([version])
}

model contract_executions {
  id                         String                     @id
  executionId                String                     @unique
  contractId                 String
  executionType              String
  executionData              Json
  intentProbabilities        Json?
  consciousnessSignatures    Json?
  quantumSymmetry            Json?
  executionResult            Json?
  status                     String                     @default("pending")
  executedAt                 DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  reality_spanning_contracts reality_spanning_contracts @relation(fields: [contractId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([executionId])
  @@index([status])
}

model contract_resolutions {
  id                         String                     @id
  resolutionId               String                     @unique
  contractId                 String
  resolutionType             String
  conflictDetails            Json?
  resolutionResult           Json?
  status                     String                     @default("pending")
  resolvedAt                 DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  reality_spanning_contracts reality_spanning_contracts @relation(fields: [contractId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([resolutionId])
  @@index([status])
}

model contradiction_events {
  id                            String                        @id
  eventId                       String                        @unique
  arbitrationId                 String
  contradictionType             String
  severity                      String
  detectedAt                    DateTime                      @default(now())
  eventData                     Json
  resolved                      Boolean                       @default(false)
  resolutionMethod              String?
  resolvedAt                    DateTime?
  createdAt                     DateTime                      @default(now())
  updatedAt                     DateTime
  quantum_temporal_arbitrations quantum_temporal_arbitrations @relation(fields: [arbitrationId], references: [id], onDelete: Cascade)

  @@index([arbitrationId])
  @@index([contradictionType])
  @@index([eventId])
  @@index([resolved])
}

model coordinated_threat_patterns {
  id                      String                  @id
  patternId               String                  @unique
  threatId                String
  patternType             String
  affectedBanks           Json
  attackVector            String?
  patternSignature        Json?
  detectedAt              DateTime                @default(now())
  status                  String                  @default("detected")
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  supra_sovereign_threats supra_sovereign_threats @relation(fields: [threatId], references: [id], onDelete: Cascade)

  @@index([patternId])
  @@index([patternType])
  @@index([status])
  @@index([threatId])
}

model crisis_protocols {
  id                 String    @id
  protocolId         String    @unique
  protocolName       String
  crisisType         String
  escalationChain    Json
  activationCriteria Json
  status             String    @default("active")
  effectiveDate      DateTime
  expiryDate         DateTime?
  activatedAt        DateTime?
  resolvedAt         DateTime?
  createdAt          DateTime  @default(now())
  updatedAt          DateTime

  @@index([crisisType])
  @@index([protocolId])
  @@index([status])
}

model crisis_stabilization_nodes {
  id               String           @id
  csnId            String           @unique
  nodeId           String
  triggerCondition String
  triggerThreshold Decimal          @db.Decimal(32, 12)
  stabilizationCap Decimal          @db.Decimal(32, 8)
  status           String           @default("standby")
  activatedAt      DateTime?
  deactivatedAt    DateTime?
  createdAt        DateTime         @default(now())
  updatedAt        DateTime
  supra_fund_nodes supra_fund_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([csnId])
  @@index([nodeId])
  @@index([status])
  @@index([triggerCondition])
}

model cross_chain_commitments {
  id                      String                  @id
  commitmentId            String                  @unique
  settlementId            String
  chainId                 String
  commitmentHash          String
  commitmentType          String
  status                  String                  @default("pending")
  committedAt             DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  cross_chain_settlements cross_chain_settlements @relation(fields: [settlementId], references: [id], onDelete: Cascade)

  @@index([chainId])
  @@index([commitmentId])
  @@index([commitmentType])
  @@index([settlementId])
}

model cross_chain_settlements {
  id                      String                    @id
  settlementId            String                    @unique
  sourceChainType         String
  sourceChainId           String
  targetChainType         String
  targetChainId           String
  sourceBankId            String
  destinationBankId       String
  amount                  Decimal                   @db.Decimal(32, 8)
  assetType               String
  status                  String                    @default("pending")
  committedAt             DateTime?
  settledAt               DateTime?
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  chain_headers           chain_headers[]
  cross_chain_commitments cross_chain_commitments[]

  @@index([settlementId])
  @@index([sourceBankId])
  @@index([sourceChainType])
  @@index([status])
  @@index([targetChainType])
}

model cryptographic_keys {
  id            String    @id
  keyId         String    @unique
  keyType       String
  keyPurpose    String
  publicKey     String
  privateKeyRef String?
  hsmKeyId      String?
  algorithm     String
  keySize       Int?
  status        String    @default("active")
  createdAt     DateTime  @default(now())
  rotatedAt     DateTime?
  expiresAt     DateTime?

  @@index([keyId])
  @@index([keyPurpose])
  @@index([keyType])
  @@index([status])
}

model custody_sub_ledger {
  id            String   @id
  ledgerEntryId String   @unique
  custodianId   String
  assetType     String
  quantity      Decimal  @db.Decimal(32, 8)
  createdAt     DateTime @default(now())

  @@index([custodianId])
}

model cyber_threat_incidents {
  id                    String                  @id
  incidentId            String                  @unique
  divisionId            String?
  threatType            String
  threatCategory        String
  severity              String
  sourceBankId          String?
  targetBankId          String?
  description           String
  detectionMethod       String
  status                String                  @default("detected")
  detectedAt            DateTime                @default(now())
  containedAt           DateTime?
  neutralizedAt         DateTime?
  resolvedAt            DateTime?
  metadata              Json?
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  dcdc_divisions        dcdc_divisions?         @relation(fields: [divisionId], references: [id])
  defense_layer_actions defense_layer_actions[]
  threat_mitigations    threat_mitigations[]

  @@index([detectedAt])
  @@index([divisionId])
  @@index([incidentId])
  @@index([severity])
  @@index([status])
  @@index([threatCategory])
}

model dbis_monetary_councils {
  id              String   @id
  councilId       String   @unique
  councilName     String   @default("DBIS Monetary & Settlement Council")
  memberCount     Int?
  votingMechanism String
  status          String   @default("active")
  createdAt       DateTime @default(now())
  updatedAt       DateTime

  @@index([councilId])
  @@index([status])
}

model dbis_roles {
  id                   String                 @id
  roleId               String                 @unique
  roleName             String
  roleDescription      String
  accessLevel          String
  permissions          Json
  status               String                 @default("active")
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  employee_credentials employee_credentials[]

  @@index([accessLevel])
  @@index([roleId])
  @@index([roleName])
}

model dcdc_divisions {
  id                     String                   @id
  divisionId             String                   @unique
  divisionType           String
  divisionName           String
  description            String
  status                 String                   @default("active")
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  cyber_threat_incidents cyber_threat_incidents[]
  defense_layer_actions  defense_layer_actions[]

  @@index([divisionId])
  @@index([divisionType])
  @@index([status])
}

model debt_ladders {
  id                 String   @id
  ladderId           String   @unique
  sovereignBankId    String
  maturityDate       DateTime
  principalAmount    Decimal  @db.Decimal(32, 8)
  currencyCode       String
  rolloverContractId String?
  status             String   @default("active")
  createdAt          DateTime @default(now())
  updatedAt          DateTime

  @@index([ladderId])
  @@index([maturityDate])
  @@index([sovereignBankId])
  @@index([status])
}

model debt_rollovers {
  id               String    @id
  rolloverId       String    @unique
  sovereignBankId  String
  originalLadderId String
  newLadderId      String?
  rolloverAmount   Decimal   @db.Decimal(32, 8)
  currencyCode     String
  fundingSource    String    @default("cbdc")
  status           String    @default("pending")
  executedAt       DateTime?
  createdAt        DateTime  @default(now())
  updatedAt        DateTime

  @@index([originalLadderId])
  @@index([rolloverId])
  @@index([sovereignBankId])
  @@index([status])
}

model default_events {
  id                String    @id
  eventId           String    @unique
  sovereignBankId   String
  eventType         String
  severity          String
  status            String    @default("active")
  description       String
  resolutionActions Json?
  createdAt         DateTime  @default(now())
  resolvedAt        DateTime?

  @@index([eventType])
  @@index([sovereignBankId])
  @@index([status])
}

model defense_layer_actions {
  id                     String                  @id
  actionId               String                  @unique
  divisionId             String?
  incidentId             String?
  layer                  String
  actionType             String
  targetNodeId           String?
  targetBankId           String?
  description            String
  actionStatus           String                  @default("pending")
  executedAt             DateTime?
  rolledBackAt           DateTime?
  metadata               Json?
  createdAt              DateTime                @default(now())
  updatedAt              DateTime
  dcdc_divisions         dcdc_divisions?         @relation(fields: [divisionId], references: [id])
  cyber_threat_incidents cyber_threat_incidents? @relation(fields: [incidentId], references: [id])

  @@index([actionId])
  @@index([actionStatus])
  @@index([divisionId])
  @@index([incidentId])
  @@index([layer])
}

model defi_liquidity_pools {
  id              String       @id
  poolId          String       @unique
  moduleId        String
  poolName        String
  assetTypes      Json
  totalLiquidity  Decimal      @default(0) @db.Decimal(32, 8)
  governanceModel String       @default("dbis_governed")
  status          String       @default("active")
  createdAt       DateTime     @default(now())
  updatedAt       DateTime
  defi_modules    defi_modules @relation(fields: [moduleId], references: [id], onDelete: Cascade)
  defi_swaps      defi_swaps[]

  @@index([moduleId])
  @@index([poolId])
  @@index([status])
}

model defi_modules {
  id                   String                 @id
  moduleId             String                 @unique
  moduleName           String
  moduleType           String
  permissionLevel      String
  status               String                 @default("pending")
  approvalDate         DateTime?
  approvedBy           String?
  moduleConfig         Json
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  defi_liquidity_pools defi_liquidity_pools[]
  defi_nodes           defi_nodes[]
  defi_swaps           defi_swaps[]

  @@index([moduleId])
  @@index([moduleType])
  @@index([permissionLevel])
  @@index([status])
}

model defi_nodes {
  id                 String       @id
  nodeId             String       @unique
  moduleId           String
  sovereignBankId    String?
  nodeType           String
  verificationStatus String       @default("pending")
  verificationDate   DateTime?
  nodeAddress        String?
  status             String       @default("active")
  createdAt          DateTime     @default(now())
  updatedAt          DateTime
  defi_modules       defi_modules @relation(fields: [moduleId], references: [id], onDelete: Cascade)

  @@index([moduleId])
  @@index([nodeId])
  @@index([sovereignBankId])
  @@index([status])
  @@index([verificationStatus])
}

model defi_swaps {
  id                   String                @id
  swapId               String                @unique
  moduleId             String
  poolId               String?
  sourceAssetType      String
  targetAssetType      String
  sourceAmount         Decimal               @db.Decimal(32, 8)
  targetAmount         Decimal               @db.Decimal(32, 8)
  exchangeRate         Decimal               @db.Decimal(32, 12)
  participantBankId    String
  scbOversight         Boolean               @default(true)
  onChainTxHash        String?
  status               String                @default("pending")
  executedAt           DateTime?
  createdAt            DateTime              @default(now())
  updatedAt            DateTime
  defi_modules         defi_modules          @relation(fields: [moduleId], references: [id], onDelete: Cascade)
  defi_liquidity_pools defi_liquidity_pools? @relation(fields: [poolId], references: [id])

  @@index([moduleId])
  @@index([poolId])
  @@index([status])
  @@index([swapId])
}

model derivative_collaterals {
  id                   String               @id
  collateralId         String               @unique
  contractId           String
  assetType            String
  assetId              String?
  amount               Decimal              @db.Decimal(32, 8)
  valuation            Decimal              @db.Decimal(32, 12)
  haircut              Decimal?             @db.Decimal(32, 12)
  status               String               @default("active")
  allocatedAt          DateTime             @default(now())
  releasedAt           DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  derivative_contracts derivative_contracts @relation(fields: [contractId], references: [id], onDelete: Cascade)

  @@index([assetType])
  @@index([collateralId])
  @@index([contractId])
  @@index([status])
}

model derivative_contracts {
  id                     String                   @id
  contractId             String                   @unique
  derivativeType         String
  party1BankId           String
  party2BankId           String
  notionalAmount         Decimal                  @db.Decimal(32, 8)
  contractTerms          Json
  smartContractId        String?
  status                 String                   @default("active")
  initiatedAt            DateTime                 @default(now())
  maturityDate           DateTime?
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  derivative_collaterals derivative_collaterals[]
  derivative_margins     derivative_margins[]
  derivative_settlements derivative_settlements[]

  @@index([contractId])
  @@index([derivativeType])
  @@index([party1BankId])
  @@index([party2BankId])
  @@index([status])
}

model derivative_margins {
  id                   String               @id
  marginId             String               @unique
  contractId           String
  marginType           String
  amount               Decimal              @db.Decimal(32, 8)
  exposure             Decimal?             @db.Decimal(32, 8)
  volatility           Decimal?             @db.Decimal(32, 12)
  sriFactor            Decimal?             @db.Decimal(32, 12)
  markToMarket         Decimal?             @db.Decimal(32, 12)
  previousMarkToMarket Decimal?             @db.Decimal(32, 12)
  calculatedAt         DateTime             @default(now())
  status               String               @default("pending")
  postedAt             DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  derivative_contracts derivative_contracts @relation(fields: [contractId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([marginId])
  @@index([marginType])
  @@index([status])
}

model derivative_settlements {
  id                   String               @id
  settlementId         String               @unique
  contractId           String
  settlementAmount     Decimal              @db.Decimal(32, 8)
  currencyCode         String
  assetType            String
  hashLock             String
  sovereignLedgerHash  String?
  dbisLedgerHash       String?
  dualLedgerCommit     Boolean              @default(false)
  status               String               @default("pending")
  committedAt          DateTime?
  settledAt            DateTime?
  finalizedAt          DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  derivative_contracts derivative_contracts @relation(fields: [contractId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([hashLock])
  @@index([settlementId])
  @@index([status])
}

model derivatives_sub_ledger {
  id             String   @id
  ledgerEntryId  String   @unique
  derivativeType String
  notionalAmount Decimal  @db.Decimal(32, 8)
  markToMarket   Decimal? @db.Decimal(32, 12)
  createdAt      DateTime @default(now())
}

model development_fund_nodes {
  id                   String           @id
  dfnId                String           @unique
  nodeId               String
  directLendingCap     Decimal          @db.Decimal(32, 8)
  commodityBackedLoans Boolean          @default(true)
  status               String           @default("active")
  createdAt            DateTime         @default(now())
  updatedAt            DateTime
  supra_fund_nodes     supra_fund_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([dfnId])
  @@index([nodeId])
  @@index([status])
}

model deviation_corrections {
  id                          String                      @id
  correctionId                String                      @unique
  stateId                     String
  deviationType               String
  deviationMagnitude          Decimal                     @db.Decimal(32, 12)
  correctionApplied           Json
  correctionMethod            String
  status                      String                      @default("pending")
  correctedAt                 DateTime?
  createdAt                   DateTime                    @default(now())
  updatedAt                   DateTime
  holographic_economic_states holographic_economic_states @relation(fields: [stateId], references: [id], onDelete: Cascade)

  @@index([correctionId])
  @@index([deviationType])
  @@index([stateId])
  @@index([status])
}

model digital_bonds {
  id                   String                 @id
  bondId               String                 @unique
  issuerBankId         String
  couponRate           Decimal                @db.Decimal(32, 12)
  maturityDate         DateTime
  principal            Decimal                @db.Decimal(32, 8)
  currencyCode         String
  settlementMode       String                 @default("cbdc")
  collateral           Json?
  hsmSignature         String
  status               String                 @default("issued")
  issuedAt             DateTime               @default(now())
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  bond_coupon_payments bond_coupon_payments[]
  bond_trades          bond_trades[]

  @@index([bondId])
  @@index([issuerBankId])
  @@index([maturityDate])
  @@index([status])
}

model digital_sovereign_economic_zones {
  id                           String                         @id
  dsezId                       String                         @unique
  metaverseNodeId              String
  sovereignBankId              String?
  virtualCitizenshipEnabled    Boolean                        @default(false)
  digitalLandEnabled           Boolean                        @default(false)
  tokenizedFxEnabled           Boolean                        @default(false)
  liquidityFlowEnabled         Boolean                        @default(false)
  status                       String                         @default("active")
  metadata                     Json?
  createdAt                    DateTime                       @default(now())
  updatedAt                    DateTime
  metaverse_nodes              metaverse_nodes                @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)
  sovereign_banks              sovereign_banks?               @relation(fields: [sovereignBankId], references: [id])
  metaverse_consistency_checks metaverse_consistency_checks[]
  metaverse_ramp_transactions  metaverse_ramp_transactions[]

  @@index([dsezId])
  @@index([metaverseNodeId])
  @@index([sovereignBankId])
  @@index([status])
}

model dimension_reconciliations {
  id                       String                   @id
  reconciliationId         String                   @unique
  ledgerId                 String
  dimensionStates          Json
  reconciledState          Json?
  consistencyCheck         Boolean                  @default(false)
  metaResolution           Json?
  status                   String                   @default("pending")
  checkedAt                DateTime?
  resolvedAt               DateTime?
  createdAt                DateTime                 @default(now())
  updatedAt                DateTime
  interdimensional_ledgers interdimensional_ledgers @relation(fields: [ledgerId], references: [id], onDelete: Cascade)

  @@index([ledgerId])
  @@index([reconciliationId])
  @@index([status])
}

model dimensional_arbitrage {
  id                              String                  @id
  arbitrageId                     String                  @unique
  dimension                       String
  timeline                        String?
  parallelBranch                  String?
  quantumState                    String?
  simulatedEconomy                String?
  classicalPrice                  Decimal                 @db.Decimal(32, 12)
  quantumExpectedPrice            Decimal                 @db.Decimal(32, 12)
  parallelStateDivergence         Decimal                 @db.Decimal(32, 12)
  holographicProjectionAdjustment Decimal                 @db.Decimal(32, 12)
  arbitrageDelta                  Decimal                 @db.Decimal(32, 12)
  tolerance                       Decimal                 @db.Decimal(32, 12)
  requiresRebalance               Boolean                 @default(false)
  status                          String                  @default("calculated")
  createdAt                       DateTime                @default(now())
  updatedAt                       DateTime
  dimensional_rebalance           dimensional_rebalance[]

  @@index([arbitrageId])
  @@index([dimension])
  @@index([requiresRebalance])
  @@index([status])
}

model dimensional_rebalance {
  id                    String                @id
  rebalanceId           String                @unique
  arbitrageId           String
  adjustmentAmount      Decimal               @db.Decimal(32, 12)
  dimension             String?
  timeline              String?
  parallelBranch        String?
  quantumState          String?
  status                String                @default("executed")
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  dimensional_arbitrage dimensional_arbitrage @relation(fields: [arbitrageId], references: [id], onDelete: Cascade)

  @@index([arbitrageId])
  @@index([rebalanceId])
  @@index([status])
}

model dispute_resolutions {
  id               String    @id
  disputeId        String    @unique
  sovereignBankId1 String
  sovereignBankId2 String
  disputeType      String
  description      String
  stage            String    @default("bilateral")
  status           String    @default("active")
  resolution       String?
  resolvedAt       DateTime?
  createdAt        DateTime  @default(now())
  updatedAt        DateTime

  @@index([disputeId])
  @@index([sovereignBankId1])
  @@index([sovereignBankId2])
  @@index([stage])
  @@index([status])
}

model distributed_ledger_interfaces {
  id                    String                @id
  interfaceId           String                @unique
  ledgerId              String
  ledgerType            String
  chainId               String?
  stateSnapshot         Json?
  status                String                @default("active")
  lastSyncAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  multi_reality_ledgers multi_reality_ledgers @relation(fields: [ledgerId], references: [id], onDelete: Cascade)

  @@index([interfaceId])
  @@index([ledgerId])
  @@index([status])
}

model dscm_nodes {
  id                 String               @id
  nodeId             String               @unique
  sovereignBankId    String?
  nodeType           String
  nodeName           String
  computeCapacity    Decimal?             @db.Decimal(32, 8)
  latency            Int?
  sovereignPriority  Int?
  riskWeight         Decimal?             @db.Decimal(32, 8)
  status             String               @default("active")
  registeredAt       DateTime             @default(now())
  lastHeartbeat      DateTime?
  createdAt          DateTime             @default(now())
  updatedAt          DateTime
  compute_tasks      compute_tasks[]
  federated_ai_tasks federated_ai_tasks[]

  @@index([nodeId])
  @@index([nodeType])
  @@index([sovereignBankId])
  @@index([status])
}

model dscn_compliance_results {
  id             String     @id
  resultId       String     @unique
  nodeId         String
  complianceType String
  entityId       String
  entityType     String
  scanResult     String
  riskScore      Decimal?   @db.Decimal(32, 8)
  details        Json
  status         String     @default("pending")
  syncedToDbis   Boolean    @default(false)
  syncedAt       DateTime?
  createdAt      DateTime   @default(now())
  updatedAt      DateTime
  dscn_nodes     dscn_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([complianceType])
  @@index([entityId])
  @@index([nodeId])
  @@index([resultId])
  @@index([scanResult])
  @@index([status])
}

model dscn_nodes {
  id                      String                    @id
  nodeId                  String                    @unique
  sovereignBankId         String?
  privateBankId           String?
  nodeType                String
  nodeName                String
  nodeAddress             String
  registrationStatus      String                    @default("pending")
  approvedAt              DateTime?
  status                  String                    @default("active")
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  dscn_compliance_results dscn_compliance_results[]
  dscn_sync_records       dscn_sync_records[]

  @@index([nodeId])
  @@index([nodeType])
  @@index([privateBankId])
  @@index([sovereignBankId])
  @@index([status])
}

model dscn_sync_records {
  id             String     @id
  syncId         String     @unique
  nodeId         String
  syncType       String
  syncData       Json
  dbisLedgerHash String?
  syncStatus     String     @default("pending")
  syncedAt       DateTime?
  createdAt      DateTime   @default(now())
  updatedAt      DateTime
  dscn_nodes     dscn_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([nodeId])
  @@index([syncId])
  @@index([syncStatus])
  @@index([syncType])
}

model economic_entanglements {
  id                        String                      @id
  entanglementId            String                      @unique
  measurementTime           DateTime                    @default(now())
  cohesionFactor            Decimal                     @db.Decimal(32, 12)
  divergencePressure        Decimal                     @db.Decimal(32, 12)
  quantumResonance          Decimal                     @db.Decimal(32, 12)
  eeiValue                  Decimal                     @db.Decimal(32, 12)
  stabilityLevel            String
  status                    String                      @default("active")
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime
  entanglement_measurements entanglement_measurements[]

  @@index([eeiValue])
  @@index([entanglementId])
  @@index([measurementTime])
  @@index([stabilityLevel])
}

model economic_harmonizations {
  id                  String               @id
  harmonizationId     String               @unique
  convergenceId       String?
  adjustmentAmount    Decimal              @db.Decimal(32, 12)
  status              String               @default("applied")
  createdAt           DateTime             @default(now())
  updatedAt           DateTime
  reality_convergence reality_convergence? @relation(fields: [convergenceId], references: [id])

  @@index([convergenceId])
  @@index([harmonizationId])
  @@index([status])
}

model economic_projections {
  id                          String                      @id
  projectionId                String                      @unique
  stateId                     String
  targetReality               String
  projectionData              Json
  projectionMethod            String
  accuracy                    Decimal?                    @db.Decimal(32, 12)
  status                      String                      @default("active")
  projectedAt                 DateTime                    @default(now())
  createdAt                   DateTime                    @default(now())
  updatedAt                   DateTime
  holographic_economic_states holographic_economic_states @relation(fields: [stateId], references: [id], onDelete: Cascade)

  @@index([projectionId])
  @@index([stateId])
  @@index([status])
  @@index([targetReality])
}

model employee_credentials {
  id                   String     @id
  employeeId           String     @unique
  roleId               String
  employeeName         String
  email                String
  securityClearance    String
  cryptographicBadgeId String?
  hsmCredentialId      String?
  status               String     @default("active")
  issuedAt             DateTime   @default(now())
  expiresAt            DateTime?
  revokedAt            DateTime?
  createdAt            DateTime   @default(now())
  updatedAt            DateTime
  dbis_roles           dbis_roles @relation(fields: [roleId], references: [id], onDelete: Cascade)

  @@index([employeeId])
  @@index([roleId])
  @@index([securityClearance])
  @@index([status])
}

model entanglement_measurements {
  id                     String                 @id
  measurementId          String                 @unique
  entanglementId         String
  measurementType        String
  measurementValue       Decimal                @db.Decimal(32, 12)
  measurementDetails     Json?
  measuredAt             DateTime               @default(now())
  createdAt              DateTime               @default(now())
  updatedAt              DateTime
  economic_entanglements economic_entanglements @relation(fields: [entanglementId], references: [id], onDelete: Cascade)

  @@index([entanglementId])
  @@index([measurementId])
  @@index([measurementType])
}

model fabric_alignments {
  id                          String                      @id
  alignmentId                 String                      @unique
  fabricId                    String
  alignmentType               String
  alignmentStatus             String
  alignmentDetails            Json?
  correctedAt                 DateTime?
  createdAt                   DateTime                    @default(now())
  updatedAt                   DateTime
  pan_reality_monetary_fabric pan_reality_monetary_fabric @relation(fields: [fabricId], references: [id], onDelete: Cascade)

  @@index([alignmentId])
  @@index([alignmentStatus])
  @@index([alignmentType])
  @@index([fabricId])
}

model fabric_integrity_checks {
  id                          String                      @id
  checkId                     String                      @unique
  fabricId                    String
  checkType                   String
  checkResult                 String
  checkDetails                Json?
  status                      String                      @default("pending")
  checkedAt                   DateTime?
  createdAt                   DateTime                    @default(now())
  updatedAt                   DateTime
  pan_reality_monetary_fabric pan_reality_monetary_fabric @relation(fields: [fabricId], references: [id], onDelete: Cascade)

  @@index([checkId])
  @@index([checkResult])
  @@index([checkType])
  @@index([fabricId])
}

model face_behavioral_engines {
  id             String         @id
  engineId       String         @unique
  economyId      String         @unique
  engineConfig   Json
  behaviorModel  String
  status         String         @default("active")
  lastUpdated    DateTime       @default(now())
  createdAt      DateTime       @default(now())
  updatedAt      DateTime
  face_economies face_economies @relation(fields: [economyId], references: [id], onDelete: Cascade)

  @@index([economyId])
  @@index([engineId])
}

model face_economies {
  id                           String                         @id
  economyId                    String                         @unique
  sovereignBankId              String
  economyName                  String
  description                  String
  economyType                  String
  status                       String                         @default("active")
  activatedAt                  DateTime                       @default(now())
  createdAt                    DateTime                       @default(now())
  updatedAt                    DateTime
  face_behavioral_engines      face_behavioral_engines?
  sovereign_banks              sovereign_banks                @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
  face_incentives              face_incentives[]
  face_stabilization_contracts face_stabilization_contracts[]
  face_supply_contracts        face_supply_contracts[]

  @@index([economyId])
  @@index([sovereignBankId])
  @@index([status])
}

model face_incentives {
  id              String         @id
  incentiveId     String         @unique
  economyId       String
  incentiveType   String
  targetBehavior  String
  incentiveAmount Decimal        @db.Decimal(32, 12)
  conditions      Json
  status          String         @default("active")
  appliedAt       DateTime?
  createdAt       DateTime       @default(now())
  updatedAt       DateTime
  face_economies  face_economies @relation(fields: [economyId], references: [id], onDelete: Cascade)

  @@index([economyId])
  @@index([incentiveId])
  @@index([incentiveType])
  @@index([status])
}

model face_stabilization_contracts {
  id                 String         @id
  contractId         String         @unique
  economyId          String
  contractType       String
  sriThreshold       Decimal        @db.Decimal(32, 12)
  rateAdjustmentRule Json
  adjustmentType     String
  status             String         @default("active")
  lastTriggeredAt    DateTime?
  createdAt          DateTime       @default(now())
  updatedAt          DateTime
  face_economies     face_economies @relation(fields: [economyId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([economyId])
  @@index([status])
}

model face_supply_contracts {
  id                      String         @id
  contractId              String         @unique
  economyId               String
  contractType            String
  velocityTarget          Decimal        @db.Decimal(32, 12)
  velocityDangerThreshold Decimal        @db.Decimal(32, 12)
  mintCondition           Json
  burnCondition           Json
  status                  String         @default("active")
  lastTriggeredAt         DateTime?
  createdAt               DateTime       @default(now())
  updatedAt               DateTime
  face_economies          face_economies @relation(fields: [economyId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([economyId])
  @@index([status])
}

model fast_track_privileges {
  id              String    @id
  privilegeId     String    @unique
  sovereignBankId String
  privilegeType   String
  grantedAt       DateTime  @default(now())
  expiresAt       DateTime?
  status          String    @default("ACTIVE")
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([privilegeId])
  @@index([privilegeType])
  @@index([sovereignBankId])
  @@index([status])
}

model federated_ai_tasks {
  id                 String     @id
  taskId             String     @unique
  nodeId             String
  aiType             String
  taskPayload        Json
  federatedNodes     Json?
  consensusResult    Json?
  status             String     @default("pending")
  startedAt          DateTime?
  consensusReachedAt DateTime?
  createdAt          DateTime   @default(now())
  updatedAt          DateTime
  dscm_nodes         dscm_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([aiType])
  @@index([nodeId])
  @@index([status])
  @@index([taskId])
}

model future_liquidity_reserves {
  id                         String                     @id
  reserveId                  String                     @unique
  portalId                   String
  predictedTime              DateTime
  predictedReserves          Decimal                    @db.Decimal(32, 8)
  confidenceLevel            Decimal                    @db.Decimal(32, 12)
  availableLiquidity         Decimal                    @db.Decimal(32, 8)
  borrowedAmount             Decimal                    @default(0) @db.Decimal(32, 8)
  status                     String                     @default("available")
  expiresAt                  DateTime
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  temporal_liquidity_portals temporal_liquidity_portals @relation(fields: [portalId], references: [id], onDelete: Cascade)

  @@index([portalId])
  @@index([predictedTime])
  @@index([reserveId])
  @@index([status])
}

model fx_cbdc_ssu_impacts {
  id                      String            @id
  impactId                String            @unique
  simulationId            String
  fxVolatility            Decimal?          @db.Decimal(32, 12)
  cbdcVelocity            Decimal?          @db.Decimal(32, 12)
  ssuWeight               Decimal?          @db.Decimal(32, 12)
  liquidityShock          Decimal?          @db.Decimal(32, 12)
  sovereignStabilityIndex Decimal?          @db.Decimal(32, 12)
  impactScore             Decimal           @db.Decimal(32, 12)
  impactType              String
  calculatedAt            DateTime          @default(now())
  createdAt               DateTime          @default(now())
  updatedAt               DateTime
  afcss_simulations       afcss_simulations @relation(fields: [simulationId], references: [id], onDelete: Cascade)

  @@index([impactId])
  @@index([impactType])
  @@index([simulationId])
}

model fx_pairs {
  id            String      @id
  baseCurrency  String
  quoteCurrency String
  pairCode      String      @unique
  pricingMethod String
  status        String      @default("active")
  createdAt     DateTime    @default(now())
  updatedAt     DateTime
  fx_trades     fx_trades[]

  @@index([baseCurrency, quoteCurrency])
  @@index([pairCode])
}

model fx_sub_ledger {
  id            String   @id
  ledgerEntryId String   @unique
  fxTradeId     String
  baseCurrency  String
  quoteCurrency String
  baseAmount    Decimal  @db.Decimal(32, 8)
  quoteAmount   Decimal  @db.Decimal(32, 8)
  fxRate        Decimal  @db.Decimal(32, 12)
  createdAt     DateTime @default(now())

  @@index([fxTradeId])
}

model fx_trades {
  id                 String          @id
  tradeId            String          @unique
  sovereignBankId    String
  fxPairId           String
  baseCurrency       String
  quoteCurrency      String
  tradeType          String
  quantity           Decimal         @db.Decimal(32, 8)
  price              Decimal         @db.Decimal(32, 12)
  orderType          String
  initiatorEntity    String
  counterpartyEntity String?
  settlementMode     String
  status             String          @default("pending")
  timestampUtc       DateTime        @default(now())
  executedAt         DateTime?
  settledAt          DateTime?
  metadata           Json?
  fx_pairs           fx_pairs        @relation(fields: [fxPairId], references: [id])
  sovereign_banks    sovereign_banks @relation(fields: [sovereignBankId], references: [id])

  @@index([sovereignBankId])
  @@index([status])
  @@index([timestampUtc])
  @@index([tradeId])
}

model otc_trades {
  id                   String   @id
  dealId               String   @unique
  clDealId             String
  quoteId              String?
  quoteReqId           String
  sovereignBankId      String?
  instrumentName       String
  side                 String
  quantity             Decimal? @db.Decimal(32, 8)
  notional             Decimal? @db.Decimal(32, 12)
  price                Decimal  @db.Decimal(32, 12)
  dealStatus           String
  settlementArrangement String?
  createTimeNs         String?
  updateTimeNs         String
  settleTimeNs         String?
  legData              Json?
  fxTradeId            String?
  createdAt            DateTime @default(now())
  updatedAt            DateTime @updatedAt

  @@index([dealId])
  @@index([clDealId])
  @@index([dealStatus])
  @@index([sovereignBankId])
  @@index([createdAt])
}

model gap_audits {
  id                     String                   @id
  auditId                String                   @unique
  auditScope             Json
  gapsFound              Int                      @default(0)
  modulesGenerated       Int                      @default(0)
  recommendationsCount   Int                      @default(0)
  status                 String                   @default("pending")
  completedAt            DateTime?
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  gap_detections         gap_detections[]
  system_recommendations system_recommendations[]

  @@index([auditId])
  @@index([status])
}

model gap_detections {
  id          String     @id
  detectionId String     @unique
  auditId     String
  gapType     String
  systemScope String
  description String
  severity    String
  status      String     @default("detected")
  createdAt   DateTime   @default(now())
  updatedAt   DateTime
  gap_audits  gap_audits @relation(fields: [auditId], references: [id], onDelete: Cascade)

  @@index([auditId])
  @@index([detectionId])
  @@index([gapType])
  @@index([severity])
  @@index([systemScope])
}

model gap_types {
  id           String   @id
  gapTypeId    String   @unique
  gapType      String   @unique
  description  String
  autoGenerate Boolean  @default(false)
  status       String   @default("active")
  createdAt    DateTime @default(now())
  updatedAt    DateTime

  @@index([gapTypeId])
  @@index([gapType])
  @@index([status])
}

model gas_commitments {
  id              String           @id
  commitmentId    String           @unique
  gasSettlementId String?          @unique
  settlementId    String
  scbCommit       String
  dbisCommit      String
  fxCommit        String?
  assetCommit     String?
  temporalState   String?
  commitmentHash  String
  status          String           @default("pending")
  verifiedAt      DateTime?
  createdAt       DateTime         @default(now())
  updatedAt       DateTime
  gas_settlements gas_settlements? @relation(fields: [gasSettlementId], references: [gasSettlementId])

  @@index([commitmentId])
  @@index([gasSettlementId])
  @@index([settlementId])
  @@index([status])
}

model gas_routing_decisions {
  id                   String            @id
  routeId              String            @unique
  settlementId         String?
  sourceBankId         String
  destinationBankId    String
  amount               Decimal           @db.Decimal(32, 8)
  currencyCode         String
  assetType            String
  networkType          String
  routingEngine        String
  optimalRoute         Json
  cost                 Decimal           @db.Decimal(32, 12)
  latency              Int
  dimensionalAlignment Decimal           @db.Decimal(32, 8)
  status               String            @default("active")
  createdAt            DateTime          @default(now())
  updatedAt            DateTime
  gas_settlements      gas_settlements[]

  @@index([destinationBankId])
  @@index([networkType])
  @@index([routeId])
  @@index([routingEngine])
  @@index([settlementId])
  @@index([sourceBankId])
  @@index([status])
}

model gas_settlements {
  id                    String                 @id
  gasSettlementId       String                 @unique
  settlementId          String?
  sourceBankId          String
  destinationBankId     String
  amount                Decimal                @db.Decimal(32, 8)
  currencyCode          String
  assetType             String
  networkType           String
  commitmentHash        String
  routeId               String?
  routingEngine         String?
  fxCommit              String?
  assetCommit           String?
  temporalState         String?
  dimensionalAlignment  Decimal?               @db.Decimal(32, 8)
  settlementTime        Int?
  status                String                 @default("pending")
  allCommitsMatched     Boolean                @default(false)
  settledAt             DateTime?
  createdAt             DateTime               @default(now())
  updatedAt             DateTime
  gas_commitments       gas_commitments?
  gas_routing_decisions gas_routing_decisions? @relation(fields: [routeId], references: [routeId])

  @@index([allCommitsMatched])
  @@index([destinationBankId])
  @@index([gasSettlementId])
  @@index([networkType])
  @@index([settlementId])
  @@index([sourceBankId])
  @@index([status])
}

model generated_modules {
  id         String   @id
  moduleId   String   @unique
  gapType    String
  moduleType String
  status     String   @default("generated")
  createdAt  DateTime @default(now())
  updatedAt  DateTime

  @@index([gapType])
  @@index([moduleId])
  @@index([moduleType])
  @@index([status])
}

model global_liquidity_pools {
  id                 String              @id
  poolId             String              @unique
  totalLiquidity     Decimal             @default(0) @db.Decimal(32, 8)
  availableLiquidity Decimal             @default(0) @db.Decimal(32, 8)
  reservedLiquidity  Decimal             @default(0) @db.Decimal(32, 8)
  currencyCode       String?
  assetType          String
  lastUpdated        DateTime            @default(now())
  createdAt          DateTime            @default(now())
  updatedAt          DateTime
  glp_contributions  glp_contributions[]
  glp_withdrawals    glp_withdrawals[]

  @@index([poolId])
}

model global_parity_engines {
  id                           String                        @id
  parityId                     String                        @unique
  umbId                        String?
  currencyCode                 String
  assetType                    String
  fxWeight                     Decimal                       @db.Decimal(32, 12)
  commodityWeight              Decimal                       @db.Decimal(32, 12)
  ssuStability                 Decimal                       @db.Decimal(32, 12)
  riskPremium                  Decimal                       @db.Decimal(32, 12)
  calculatedParity             Decimal                       @db.Decimal(32, 12)
  status                       String                        @default("active")
  calculatedAt                 DateTime                      @default(now())
  createdAt                    DateTime                      @default(now())
  updatedAt                    DateTime
  alignment_contracts          alignment_contracts[]
  universal_monetary_baselines universal_monetary_baselines? @relation(fields: [umbId], references: [id])

  @@index([assetType])
  @@index([currencyCode])
  @@index([parityId])
  @@index([status])
}

model global_sanctions_lists {
  id            String    @id
  entityName    String
  entityType    String
  listSource    String
  listId        String
  country       String?
  status        String    @default("active")
  effectiveDate DateTime
  expiryDate    DateTime?
  metadata      Json?
  createdAt     DateTime  @default(now())
  updatedAt     DateTime

  @@unique([entityName, listSource])
  @@index([entityName])
  @@index([listSource])
  @@index([status])
}

model glp_contributions {
  id                     String                 @id
  contributionId         String                 @unique
  poolId                 String
  sovereignBankId        String
  contributionType       String
  amount                 Decimal                @db.Decimal(32, 8)
  currencyCode           String?
  assetType              String?
  status                 String                 @default("pending")
  confirmedAt            DateTime?
  createdAt              DateTime               @default(now())
  updatedAt              DateTime
  global_liquidity_pools global_liquidity_pools @relation(fields: [poolId], references: [id], onDelete: Cascade)

  @@index([contributionId])
  @@index([poolId])
  @@index([sovereignBankId])
  @@index([status])
}

model glp_withdrawals {
  id                     String                 @id
  withdrawalId           String                 @unique
  poolId                 String
  sovereignBankId        String
  amount                 Decimal                @db.Decimal(32, 8)
  currencyCode           String?
  withdrawalTier         String
  liquidityScore         Decimal?               @db.Decimal(32, 8)
  triggerCondition       String?
  approvalEntityId       String?
  approvalStatus         String                 @default("pending")
  approvedAt             DateTime?
  executedAt             DateTime?
  createdAt              DateTime               @default(now())
  updatedAt              DateTime
  global_liquidity_pools global_liquidity_pools @relation(fields: [poolId], references: [id], onDelete: Cascade)

  @@index([poolId])
  @@index([sovereignBankId])
  @@index([withdrawalId])
  @@index([withdrawalTier])
}

model governance_bodies {
  id                      String                    @id
  bodyType                String
  name                    String
  description             String
  memberCount             Int?
  votingMechanism         String
  status                  String                    @default("active")
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  governance_body_members governance_body_members[]
  voting_records          voting_records[]

  @@index([bodyType])
  @@index([status])
}

model governance_body_members {
  id                String            @id
  governanceBodyId  String
  sovereignBankId   String?
  memberName        String
  memberRole        String
  votingWeight      Decimal?          @db.Decimal(32, 8)
  status            String            @default("active")
  appointedAt       DateTime          @default(now())
  termEndDate       DateTime?
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  governance_bodies governance_bodies @relation(fields: [governanceBodyId], references: [id], onDelete: Cascade)

  @@index([governanceBodyId])
  @@index([sovereignBankId])
}

model governance_tiers {
  id                                                             String             @id
  tierId                                                         String             @unique
  tierNumber                                                     Int
  tierName                                                       String
  description                                                    String
  authorityScope                                                 Json
  status                                                         String             @default("active")
  createdAt                                                      DateTime           @default(now())
  updatedAt                                                      DateTime
  tier_delegations_tier_delegations_fromTierIdTogovernance_tiers tier_delegations[] @relation("tier_delegations_fromTierIdTogovernance_tiers")
  tier_delegations_tier_delegations_toTierIdTogovernance_tiers   tier_delegations[] @relation("tier_delegations_toTierIdTogovernance_tiers")

  @@index([status])
  @@index([tierId])
  @@index([tierNumber])
}

model gpn_payments {
  id                   String                 @id
  paymentId            String                 @unique
  sourceBankId         String
  destinationBankId    String
  amount               Decimal                @db.Decimal(32, 8)
  currencyCode         String
  assetType            String
  paymentType          String
  routeId              String?
  layer1Status         String                 @default("pending")
  layer2Status         String                 @default("pending")
  layer3Status         String                 @default("pending")
  hashLock             String?
  scbLedgerHash        String?
  dbisLedgerHash       String?
  isoMessageId         String?
  smeEnvelope          Json?
  status               String                 @default("pending")
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  gpn_routes           gpn_routes?            @relation(fields: [routeId], references: [id])
  gpn_settlement_locks gpn_settlement_locks[]

  @@index([destinationBankId])
  @@index([hashLock])
  @@index([paymentId])
  @@index([routeId])
  @@index([sourceBankId])
  @@index([status])
}

model gpn_routes {
  id                String         @id
  routeId           String         @unique
  sourceBankId      String
  destinationBankId String
  currencyCode      String
  routePath         Json
  fxCost            Decimal        @db.Decimal(32, 12)
  liquidityScore    Decimal        @db.Decimal(32, 8)
  sriWeight         Decimal        @db.Decimal(32, 8)
  totalCost         Decimal        @db.Decimal(32, 12)
  status            String         @default("active")
  createdAt         DateTime       @default(now())
  updatedAt         DateTime
  gpn_payments      gpn_payments[]

  @@index([destinationBankId])
  @@index([routeId])
  @@index([sourceBankId])
  @@index([status])
}

model gpn_settlement_locks {
  id             String       @id
  lockId         String       @unique
  paymentId      String
  hashLock       String
  scbLedgerHash  String?
  dbisLedgerHash String?
  lockStatus     String       @default("pending")
  matchedAt      DateTime?
  expiresAt      DateTime
  createdAt      DateTime     @default(now())
  updatedAt      DateTime
  gpn_payments   gpn_payments @relation(fields: [paymentId], references: [id], onDelete: Cascade)

  @@index([hashLock])
  @@index([lockId])
  @@index([lockStatus])
  @@index([paymentId])
}

model gpu_edge_deployments {
  id               String           @id
  deploymentId     String           @unique
  regionId         String
  nodeTypes        Json
  nodesCreated     Json
  status           String           @default("pending")
  deployedAt       DateTime?
  createdAt        DateTime         @default(now())
  updatedAt        DateTime
  gpu_edge_regions gpu_edge_regions @relation(fields: [regionId], references: [regionId], onDelete: Cascade)

  @@index([deploymentId])
  @@index([regionId])
  @@index([status])
}

model gpu_edge_networks {
  id                 String   @id
  routeId            String   @unique
  sourceRegionId     String
  targetRegionId     String
  sourceNodeId       String
  targetNodeId       String
  path               Json
  estimatedLatency   Decimal  @db.Decimal(32, 8)
  quantumSafe        Boolean  @default(false)
  latencyRequirement Decimal  @db.Decimal(32, 8)
  status             String   @default("active")
  createdAt          DateTime @default(now())
  updatedAt          DateTime

  @@index([routeId])
  @@index([sourceRegionId])
  @@index([status])
  @@index([targetRegionId])
}

model gpu_edge_nodes {
  id                          String           @id
  nodeId                      String           @unique
  nodeType                    String
  regionId                    String
  nodeName                    String
  gpuCapacity                 Int
  networkAddress              String
  quantumSafeTunnelingEnabled Boolean          @default(false)
  status                      String           @default("active")
  createdAt                   DateTime         @default(now())
  updatedAt                   DateTime
  gpu_edge_regions            gpu_edge_regions @relation(fields: [regionId], references: [regionId], onDelete: Cascade)
  gpu_edge_tasks              gpu_edge_tasks[]

  @@index([nodeId])
  @@index([nodeType])
  @@index([regionId])
  @@index([status])
}

model gpu_edge_regions {
  id                   String                 @id
  regionId             String                 @unique
  regionName           String
  status               String                 @default("active")
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  gpu_edge_deployments gpu_edge_deployments[]
  gpu_edge_nodes       gpu_edge_nodes[]

  @@index([regionId])
  @@index([status])
}

model gpu_edge_tasks {
  id             String         @id
  taskId         String         @unique
  nodeId         String
  taskType       String
  status         String         @default("pending")
  result         Json?
  createdAt      DateTime       @default(now())
  updatedAt      DateTime
  gpu_edge_nodes gpu_edge_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([nodeId])
  @@index([status])
  @@index([taskId])
  @@index([taskType])
}

model gql_blocks {
  id                  String                @id
  blockId             String                @unique
  timestamp           DateTime              @default(now())
  pqSignatures        Json
  quantumStateCommit  String?
  multiAssetRoot      String
  previousBlockHash   String?
  blockHash           String
  status              String                @default("pending")
  verifiedAt          DateTime?
  finalizedAt         DateTime?
  createdAt           DateTime              @default(now())
  updatedAt           DateTime
  pq_signature_blocks pq_signature_blocks[]
  quantum_hashes      quantum_hashes[]

  @@index([blockHash])
  @@index([blockId])
  @@index([previousBlockHash])
  @@index([status])
}

model gru_account_classes {
  accountClass String         @id
  className    String
  entityType   String
  purpose      String
  permissions  Json
  status       String         @default("active")
  createdAt    DateTime       @default(now())
  updatedAt    DateTime
  gru_accounts gru_accounts[]
}

model gru_account_reconciliations {
  id                 String       @id
  reconciliationId   String       @unique
  accountId          String
  reconciliationDate DateTime     @default(now())
  openingBalance     Decimal      @db.Decimal(32, 8)
  closingBalance     Decimal      @db.Decimal(32, 8)
  expectedBalance    Decimal      @db.Decimal(32, 8)
  variance           Decimal?     @db.Decimal(32, 8)
  variancePercent    Decimal?     @db.Decimal(32, 8)
  status             String       @default("pending")
  resolvedAt         DateTime?
  createdAt          DateTime     @default(now())
  updatedAt          DateTime
  gru_accounts       gru_accounts @relation(fields: [accountId], references: [id], onDelete: Cascade)

  @@index([accountId])
  @@index([reconciliationDate])
  @@index([reconciliationId])
  @@index([status])
}

model gru_account_transactions {
  id              String       @id
  transactionId   String       @unique
  accountId       String
  transactionType String
  amount          Decimal      @db.Decimal(32, 8)
  currencyCode    String
  referenceId     String?
  status          String       @default("pending")
  executedAt      DateTime?
  createdAt       DateTime     @default(now())
  updatedAt       DateTime
  gru_accounts    gru_accounts @relation(fields: [accountId], references: [id], onDelete: Cascade)

  @@index([accountId])
  @@index([status])
  @@index([transactionId])
  @@index([transactionType])
}

model gru_accounts {
  id                          String                        @id
  accountId                   String                        @unique
  accountClass                String
  entityId                    String
  entityType                  String
  accountNumber               String                        @unique
  balance                     Decimal                       @default(0) @db.Decimal(32, 8)
  availableBalance            Decimal                       @default(0) @db.Decimal(32, 8)
  reservedBalance             Decimal                       @default(0) @db.Decimal(32, 8)
  currencyCode                String                        @default("GRU")
  status                      String                        @default("active")
  openedAt                    DateTime                      @default(now())
  closedAt                    DateTime?
  createdAt                   DateTime                      @default(now())
  updatedAt                   DateTime
  gru_account_reconciliations gru_account_reconciliations[]
  gru_account_transactions    gru_account_transactions[]
  gru_account_classes         gru_account_classes           @relation(fields: [accountClass], references: [accountClass])

  @@index([accountClass])
  @@index([accountId])
  @@index([accountNumber])
  @@index([entityId])
  @@index([status])
}

model gru_adoptions {
  id                    String    @id
  adoptionId            String    @unique
  entityId              String
  entityType            String
  currentPhase          String    @default("alignment")
  alignmentStatus       String    @default("pending")
  integrationStatus     String    @default("pending")
  expansionStatus       String    @default("pending")
  regulatorySyncDate    DateTime?
  reserveConversionDate DateTime?
  regionalPoolJoinDate  DateTime?
  status                String    @default("active")
  initiatedAt           DateTime  @default(now())
  completedAt           DateTime?
  createdAt             DateTime  @default(now())
  updatedAt             DateTime

  @@index([adoptionId])
  @@index([currentPhase])
  @@index([entityId])
  @@index([status])
}

model gru_allocation_records {
  id                        String                     @id
  allocationId              String                     @unique
  applicationId             String?                    @unique
  issuanceId                String?
  allocatedAmount           Decimal                    @db.Decimal(32, 8)
  allocatedUnitType         String
  allocationDate            DateTime                   @default(now())
  status                    String                     @default("allocated")
  createdAt                 DateTime                   @default(now())
  updatedAt                 DateTime
  gru_issuance_applications gru_issuance_applications? @relation(fields: [applicationId], references: [applicationId], onDelete: Cascade)

  @@index([allocationId])
  @@index([applicationId])
  @@index([issuanceId])
}

model gru_bond_coupons {
  id           String    @id
  paymentId    String    @unique
  bondId       String
  couponAmount Decimal   @db.Decimal(32, 8)
  paymentDate  DateTime
  status       String    @default("paid")
  createdAt    DateTime  @default(now())
  updatedAt    DateTime
  gru_bonds    gru_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([paymentId])
  @@index([status])
}

model gru_bond_markets {
  id                       String                     @id
  marketId                 String                     @unique
  marketLayer              String
  marketName               String
  description              String
  minInvestment            Decimal?                   @db.Decimal(32, 8)
  maxInvestment            Decimal?                   @db.Decimal(32, 8)
  participantTypes         Json
  status                   String                     @default("active")
  createdAt                DateTime                   @default(now())
  updatedAt                DateTime
  bond_market_listings     bond_market_listings[]
  bond_market_participants bond_market_participants[]

  @@index([marketId])
  @@index([marketLayer])
  @@index([status])
}

model gru_bond_pricing {
  id                  String               @id
  pricingId           String               @unique
  bondId              String?
  syntheticBondId     String?
  pricingModel        String
  basePrice           Decimal              @db.Decimal(32, 12)
  indexAdjustment     Decimal?             @db.Decimal(32, 12)
  liquidityAdjustment Decimal?             @db.Decimal(32, 12)
  riskAdjustment      Decimal?             @db.Decimal(32, 12)
  finalPrice          Decimal              @db.Decimal(32, 12)
  yield               Decimal?             @db.Decimal(32, 12)
  discountRate        Decimal?             @db.Decimal(32, 12)
  calculationDetails  Json?
  calculatedAt        DateTime             @default(now())
  createdAt           DateTime             @default(now())
  updatedAt           DateTime
  gru_bonds           gru_bonds?           @relation(fields: [bondId], references: [bondId])
  synthetic_gru_bonds synthetic_gru_bonds? @relation(fields: [syntheticBondId], references: [syntheticBondId])

  @@index([bondId])
  @@index([calculatedAt])
  @@index([pricingId])
  @@index([pricingModel])
  @@index([syntheticBondId])
}

model gru_bond_settlements {
  id                        String                      @id
  settlementId              String                      @unique
  bondId                    String?
  syntheticBondId           String?
  transactionId             String?
  sourceBankId              String
  destinationBankId         String
  amount                    Decimal                     @db.Decimal(32, 8)
  currencyCode              String
  settlementStage           String
  qpsTransactionId          String?
  gasSettlementId           String?
  omegaLayerHash            String?
  primeLedgerHash           String?
  perpetualState            Json?
  status                    String                      @default("pending")
  qpsCompletedAt            DateTime?
  gasCompletedAt            DateTime?
  omegaCompletedAt          DateTime?
  settledAt                 DateTime?
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime
  bond_settlement_pipelines bond_settlement_pipelines[]
  gru_bonds                 gru_bonds?                  @relation(fields: [bondId], references: [bondId])
  synthetic_gru_bonds       synthetic_gru_bonds?        @relation(fields: [syntheticBondId], references: [syntheticBondId])

  @@index([bondId])
  @@index([settlementId])
  @@index([settlementStage])
  @@index([status])
  @@index([syntheticBondId])
  @@index([transactionId])
}

model gru_bonds {
  id                    String                  @id
  bondId                String                  @unique
  bondType              String
  principalAmount       Decimal                 @db.Decimal(32, 8)
  gruUnitId             String
  sovereignBankId       String
  maturityDate          DateTime
  interestRate          Decimal                 @db.Decimal(32, 8)
  couponRate            Decimal                 @db.Decimal(32, 8)
  finalValue            Decimal?                @db.Decimal(32, 8)
  status                String                  @default("active")
  issuedAt              DateTime                @default(now())
  redeemedAt            DateTime?
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  bond_pricing_history  bond_pricing_history[]
  bond_risk_assessments bond_risk_assessments[]
  gru_bond_coupons      gru_bond_coupons[]
  gru_bond_pricing      gru_bond_pricing[]
  gru_bond_settlements  gru_bond_settlements[]
  gru_units             gru_units               @relation(fields: [gruUnitId], references: [id], onDelete: Cascade)
  synthetic_gru_bonds   synthetic_gru_bonds[]

  @@index([bondId])
  @@index([bondType])
  @@index([gruUnitId])
  @@index([sovereignBankId])
  @@index([status])
}

model gru_chrono_fx {
  id                       String                   @id
  chronoFxId               String                   @unique
  settlementId             String
  sourceCurrency           String
  targetCurrency           String
  baseRate                 Decimal                  @db.Decimal(32, 12)
  timeDilation             Decimal                  @db.Decimal(32, 12)
  delaySeconds             Int?
  adjustedRate             Decimal                  @db.Decimal(32, 12)
  relativityFactor         Decimal?                 @db.Decimal(32, 12)
  calculationMethod        String
  status                   String                   @default("calculated")
  createdAt                DateTime                 @default(now())
  updatedAt                DateTime
  gru_temporal_settlements gru_temporal_settlements @relation(fields: [settlementId], references: [id], onDelete: Cascade)

  @@index([chronoFxId])
  @@index([settlementId])
  @@index([sourceCurrency, targetCurrency])
}

model gru_compliance_records {
  id                   String               @id
  recordId             String               @unique
  issuanceId           String?
  frameworkId          String
  complianceType       String
  complianceStatus     String               @default("pending")
  verificationDate     DateTime?
  verifiedBy           String?
  details              Json?
  notes                String?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  gru_legal_frameworks gru_legal_frameworks @relation(fields: [frameworkId], references: [frameworkId], onDelete: Cascade)
  gru_issuances        gru_issuances?       @relation(fields: [issuanceId], references: [issuanceId])

  @@index([complianceStatus])
  @@index([complianceType])
  @@index([frameworkId])
  @@index([issuanceId])
  @@index([recordId])
}

model gru_compliance_snapshots {
  id                  String    @id
  snapshotId          String    @unique
  snapshotDate        DateTime  @default(now())
  snapshotType        String
  snapshotData        Json
  ariSubmissionStatus String    @default("pending")
  ariSubmissionId     String?
  submittedAt         DateTime?
  createdAt           DateTime  @default(now())
  updatedAt           DateTime

  @@index([ariSubmissionStatus])
  @@index([snapshotDate])
  @@index([snapshotId])
  @@index([snapshotType])
}

model gru_compositions {
  id                 String   @id
  compositionId      String   @unique
  m00Amount          Decimal  @db.Decimal(32, 8)
  m0Amount           Decimal  @db.Decimal(32, 8)
  m1Amount           Decimal  @db.Decimal(32, 8)
  totalM00Equivalent Decimal  @db.Decimal(32, 8)
  status             String   @default("active")
  createdAt          DateTime @default(now())
  updatedAt          DateTime

  @@index([compositionId])
  @@index([status])
}

model gru_conversions {
  id             String   @id
  conversionId   String   @unique
  sourceAmount   Decimal  @db.Decimal(32, 8)
  sourceType     String
  targetAmount   Decimal  @db.Decimal(32, 8)
  targetType     String
  conversionRate Decimal  @db.Decimal(32, 12)
  status         String   @default("completed")
  createdAt      DateTime @default(now())
  updatedAt      DateTime

  @@index([conversionId])
  @@index([sourceType])
  @@index([status])
  @@index([targetType])
}

model gru_daily_operations {
  id                          String                      @id
  operationId                 String                      @unique
  operationDate               DateTime                    @default(now())
  operationType               String
  ledgerNodesInitialized      Boolean                     @default(false)
  indexEngineSynced           Boolean                     @default(false)
  qekVerified                 Boolean                     @default(false)
  omegaDiagnosticRun          Boolean                     @default(false)
  gasReconciled               Boolean                     @default(false)
  quantumDriftCorrected       Boolean                     @default(false)
  sovereignExposureUpdated    Boolean                     @default(false)
  complianceSnapshotGenerated Boolean                     @default(false)
  status                      String                      @default("in_progress")
  completedAt                 DateTime?
  createdAt                   DateTime                    @default(now())
  updatedAt                   DateTime
  gru_end_of_day_closeouts    gru_end_of_day_closeouts[]
  gru_index_syncs             gru_index_syncs[]
  gru_ledger_nodes            gru_ledger_nodes[]
  gru_omega_diagnostics       gru_omega_diagnostics[]
  gru_quantum_envelope_keys   gru_quantum_envelope_keys[]

  @@index([operationDate])
  @@index([operationId])
  @@index([operationType])
  @@index([status])
}

model gru_derivatives {
  id                    String                 @id
  derivativeId          String                 @unique
  derivativeType        String
  instrumentType        String
  sovereignBankId       String
  counterpartyBankId    String?
  notionalAmount        Decimal                @db.Decimal(32, 8)
  contractPrice         Decimal                @db.Decimal(32, 12)
  markToMarket          Decimal?               @db.Decimal(32, 12)
  settlementCurrency    String
  status                String                 @default("active")
  contractDate          DateTime               @default(now())
  expirationDate        DateTime?
  settlementDate        DateTime?
  createdAt             DateTime               @default(now())
  updatedAt             DateTime
  gru_futures_contracts gru_futures_contracts?
  gru_options           gru_options?
  gru_swaps             gru_swaps?

  @@index([derivativeId])
  @@index([derivativeType])
  @@index([expirationDate])
  @@index([sovereignBankId])
  @@index([status])
}

model gru_eligibility_reviews {
  id                             String                          @id
  reviewId                       String                          @unique
  applicationId                  String?                         @unique
  classificationId               String?
  reviewType                     String
  sovereignStatus                Boolean                         @default(false)
  reserveAdequacy                Boolean                         @default(false)
  legalRecognition               Boolean                         @default(false)
  ilieVerification               Boolean                         @default(false)
  reviewResult                   String                          @default("pending")
  reviewNotes                    String?
  reviewedBy                     String?
  reviewedAt                     DateTime?
  createdAt                      DateTime                        @default(now())
  updatedAt                      DateTime
  gru_issuance_applications      gru_issuance_applications?      @relation(fields: [applicationId], references: [applicationId], onDelete: Cascade)
  gru_regulatory_classifications gru_regulatory_classifications? @relation(fields: [classificationId], references: [classificationId])

  @@index([applicationId])
  @@index([reviewId])
  @@index([reviewResult])
}

model gru_end_of_day_closeouts {
  id                            String               @id
  closeoutId                    String               @unique
  operationId                   String
  closeoutDate                  DateTime             @default(now())
  gasReconciliationStatus       String               @default("pending")
  quantumDriftCorrectionStatus  String               @default("pending")
  sovereignExposureUpdateStatus String               @default("pending")
  complianceSnapshotStatus      String               @default("pending")
  status                        String               @default("in_progress")
  completedAt                   DateTime?
  createdAt                     DateTime             @default(now())
  updatedAt                     DateTime
  gru_daily_operations          gru_daily_operations @relation(fields: [operationId], references: [id], onDelete: Cascade)

  @@index([closeoutDate])
  @@index([closeoutId])
  @@index([operationId])
  @@index([status])
}

model gru_futures_contracts {
  id                String          @id
  futuresId         String          @unique
  derivativeId      String          @unique
  contractType      String
  marginClass       String
  marginRequirement Decimal         @db.Decimal(32, 8)
  maintenanceMargin Decimal         @db.Decimal(32, 8)
  initialMargin     Decimal         @db.Decimal(32, 8)
  contractSize      Decimal         @db.Decimal(32, 8)
  tickSize          Decimal         @db.Decimal(32, 12)
  settlementPrice   Decimal?        @db.Decimal(32, 12)
  lastPrice         Decimal?        @db.Decimal(32, 12)
  openInterest      Decimal?        @db.Decimal(32, 8)
  volume            Decimal?        @db.Decimal(32, 8)
  deliveryDate      DateTime
  createdAt         DateTime        @default(now())
  updatedAt         DateTime
  gru_derivatives   gru_derivatives @relation(fields: [derivativeId], references: [id], onDelete: Cascade)

  @@index([deliveryDate])
  @@index([derivativeId])
  @@index([futuresId])
  @@index([marginClass])
}

model gru_fx_corridors {
  id             String   @id
  corridorId     String   @unique
  monitoringDate DateTime @default(now())
  currencyPair   String
  currentRate    Decimal  @db.Decimal(32, 12)
  upperBound     Decimal  @db.Decimal(32, 12)
  lowerBound     Decimal  @db.Decimal(32, 12)
  corridorStatus String   @default("within")
  createdAt      DateTime @default(now())
  updatedAt      DateTime

  @@index([corridorId])
  @@index([corridorStatus])
  @@index([currencyPair])
  @@index([monitoringDate])
}

model gru_gas_settlements {
  id                       String                    @id
  settlementId             String                    @unique
  pipelineId               String?                   @unique
  gasTransactionId         String
  atomicNetwork            String
  settlementAmount         Decimal                   @db.Decimal(32, 8)
  currencyCode             String
  atomicConfirmation       String?
  status                   String                    @default("pending")
  confirmedAt              DateTime?
  createdAt                DateTime                  @default(now())
  updatedAt                DateTime
  gru_settlement_pipelines gru_settlement_pipelines? @relation(fields: [pipelineId], references: [pipelineId], onDelete: Cascade)

  @@index([gasTransactionId])
  @@index([pipelineId])
  @@index([settlementId])
  @@index([status])
}

model gru_index_price_history {
  id            String      @id
  historyId     String      @unique
  indexId       String
  indexCode     String
  indexValue    Decimal     @db.Decimal(32, 12)
  changePercent Decimal?    @db.Decimal(32, 8)
  volume        Decimal?    @db.Decimal(32, 8)
  metadata      Json?
  timestamp     DateTime    @default(now())
  createdAt     DateTime    @default(now())
  gru_indexes   gru_indexes @relation(fields: [indexId], references: [id], onDelete: Cascade)

  @@index([historyId])
  @@index([indexCode])
  @@index([indexId])
  @@index([timestamp])
}

model gru_index_syncs {
  id                   String               @id
  syncId               String               @unique
  operationId          String
  indexCode            String
  syncStatus           String               @default("pending")
  lastSyncedValue      Decimal?             @db.Decimal(32, 12)
  syncTimestamp        DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  gru_daily_operations gru_daily_operations @relation(fields: [operationId], references: [id], onDelete: Cascade)

  @@index([indexCode])
  @@index([operationId])
  @@index([syncId])
  @@index([syncStatus])
}

model gru_index_validations {
  id                        String                     @id
  validationId              String                     @unique
  applicationId             String?                    @unique
  indexCode                 String
  indexValue                Decimal                    @db.Decimal(32, 12)
  validationResult          String                     @default("pending")
  validationNotes           String?
  validatedBy               String?
  validatedAt               DateTime?
  createdAt                 DateTime                   @default(now())
  updatedAt                 DateTime
  gru_issuance_applications gru_issuance_applications? @relation(fields: [applicationId], references: [applicationId], onDelete: Cascade)

  @@index([applicationId])
  @@index([indexCode])
  @@index([validationId])
}

model gru_indexes {
  id                      String                    @id
  indexId                 String                    @unique
  indexCode               String                    @unique
  indexName               String
  description             String
  baseValue               Decimal                   @db.Decimal(32, 12)
  currentValue            Decimal                   @db.Decimal(32, 12)
  calculationMethod       String
  weightings              Json?
  updateFrequency         String                    @default("real_time")
  status                  String                    @default("active")
  lastUpdated             DateTime                  @default(now())
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  gru_index_price_history gru_index_price_history[]

  @@index([indexCode])
  @@index([indexId])
  @@index([lastUpdated])
  @@index([status])
}

model gru_issuance_applications {
  id                         String                     @id
  applicationId              String                     @unique
  entityId                   String
  entityType                 String
  requestedAmount            Decimal                    @db.Decimal(32, 8)
  requestedUnitType          String
  requestedIndexLink         String
  regulatoryClass            String?
  status                     String                     @default("submitted")
  currentStep                String                     @default("application")
  submittedAt                DateTime                   @default(now())
  completedAt                DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  gru_allocation_records     gru_allocation_records?
  gru_eligibility_reviews    gru_eligibility_reviews?
  gru_index_validations      gru_index_validations?
  gru_supranational_entities gru_supranational_entities @relation(fields: [entityId], references: [id], onDelete: Cascade)

  @@index([applicationId])
  @@index([currentStep])
  @@index([entityId])
  @@index([status])
}

model gru_issuance_audits {
  id            String        @id
  auditId       String        @unique
  issuanceId    String
  auditType     String
  auditResult   String
  auditDetails  Json?
  auditorId     String
  auditDate     DateTime      @default(now())
  nextAuditDate DateTime?
  createdAt     DateTime      @default(now())
  updatedAt     DateTime
  gru_issuances gru_issuances @relation(fields: [issuanceId], references: [id], onDelete: Cascade)

  @@index([auditDate])
  @@index([auditId])
  @@index([auditResult])
  @@index([auditType])
  @@index([issuanceId])
}

model gru_issuances {
  id                        String                     @id
  issuanceId                String                     @unique
  gruUnitId                 String
  sovereignBankId           String
  issuanceClass             String
  issuanceType              String
  amount                    Decimal                    @db.Decimal(32, 8)
  unitType                  String
  metalIndexLink            String
  xauTriangulationAuditId   String?
  indexSignatureConsistency Boolean                    @default(false)
  registrarOfficeId         String
  supranationalEntityId     String?
  reserveClass              String?
  regulatoryClass           String?
  eligibilityStatus         String?
  smiaCompliance            Boolean                    @default(false)
  ilieCompliance            Boolean                    @default(false)
  status                    String                     @default("pending")
  issuedAt                  DateTime?
  approvedAt                DateTime?
  createdAt                 DateTime                   @default(now())
  updatedAt                 DateTime
  gru_compliance_records    gru_compliance_records[]
  gru_issuance_audits       gru_issuance_audits[]
  supranational_entities    supranational_entities?    @relation(fields: [supranationalEntityId], references: [id])
  gru_legal_registrations   gru_legal_registrations[]
  gru_settlement_pipelines  gru_settlement_pipelines[]

  @@index([issuanceClass])
  @@index([issuanceId])
  @@index([metalIndexLink])
  @@index([regulatoryClass])
  @@index([reserveClass])
  @@index([sovereignBankId])
  @@index([status])
  @@index([supranationalEntityId])
}

model gru_ledger_nodes {
  id                   String               @id
  nodeId               String               @unique
  operationId          String
  nodeType             String
  nodeStatus           String               @default("initializing")
  lastSyncAt           DateTime?
  syncStatus           String               @default("pending")
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  gru_daily_operations gru_daily_operations @relation(fields: [operationId], references: [id], onDelete: Cascade)

  @@index([nodeId])
  @@index([nodeStatus])
  @@index([operationId])
}

model gru_legal_frameworks {
  id                     String                   @id
  frameworkId            String                   @unique
  frameworkType          String
  frameworkName          String
  description            String
  complianceRequired     Boolean                  @default(true)
  status                 String                   @default("active")
  effectiveDate          DateTime                 @default(now())
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  gru_compliance_records gru_compliance_records[]

  @@index([frameworkId])
  @@index([frameworkType])
  @@index([status])
}

model gru_legal_registrations {
  id               String        @id
  registrationId   String        @unique
  issuanceId       String
  registrationType String
  registrationCode String        @unique
  checkDigit       String?
  registrationDate DateTime      @default(now())
  status           String        @default("active")
  createdAt        DateTime      @default(now())
  updatedAt        DateTime
  gru_issuances    gru_issuances @relation(fields: [issuanceId], references: [id], onDelete: Cascade)

  @@index([issuanceId])
  @@index([registrationCode])
  @@index([registrationId])
  @@index([registrationType])
}

model gru_liquidity_demand {
  id          String   @id
  demandId    String   @unique
  demandDate  DateTime @default(now())
  indexCode   String
  demandLevel Decimal  @db.Decimal(32, 8)
  demandType  String
  createdAt   DateTime @default(now())
  updatedAt   DateTime

  @@index([demandDate])
  @@index([demandId])
  @@index([indexCode])
}

model gru_liquidity_loops {
  id                String    @id
  loopId            String    @unique
  sourceBankId      String
  destinationBankId String
  initialAmount     Decimal   @db.Decimal(32, 8)
  targetAmount      Decimal   @db.Decimal(32, 8)
  targetNetValue    Decimal   @db.Decimal(32, 8)
  currentAmount     Decimal?  @db.Decimal(32, 8)
  currentNetValue   Decimal?  @db.Decimal(32, 8)
  finalAmount       Decimal?  @db.Decimal(32, 8)
  finalNetValue     Decimal?  @db.Decimal(32, 8)
  iterations        Int       @default(0)
  targetReached     Boolean   @default(false)
  lastTransactionId String?
  status            String    @default("running")
  completedAt       DateTime?
  createdAt         DateTime  @default(now())
  updatedAt         DateTime

  @@index([destinationBankId])
  @@index([loopId])
  @@index([sourceBankId])
  @@index([status])
}

model gru_liquidity_monitoring {
  id                 String   @id
  monitoringId       String   @unique
  monitoringDate     DateTime @default(now())
  xauAnchorValue     Decimal  @db.Decimal(32, 8)
  xauAnchorStability Decimal  @db.Decimal(32, 8)
  stabilityStatus    String   @default("stable")
  createdAt          DateTime @default(now())
  updatedAt          DateTime

  @@index([monitoringDate])
  @@index([monitoringId])
  @@index([stabilityStatus])
}

model gru_liquidity_predictions {
  id                 String   @id
  predictionId       String   @unique
  predictionDate     DateTime @default(now())
  timeHorizon        String
  predictedLiquidity Decimal  @db.Decimal(32, 8)
  confidenceLevel    Decimal  @db.Decimal(32, 8)
  modelVersion       String
  createdAt          DateTime @default(now())
  updatedAt          DateTime

  @@index([predictionDate])
  @@index([predictionId])
  @@index([timeHorizon])
}

model gru_monetary_councils {
  id                String   @id
  councilId         String   @unique
  councilName       String
  authorityLevel    String
  jurisdiction      String?
  issuanceAuthority Boolean  @default(true)
  approvalRequired  Boolean  @default(true)
  status            String   @default("active")
  createdAt         DateTime @default(now())
  updatedAt         DateTime

  @@index([authorityLevel])
  @@index([councilId])
  @@index([status])
}

model gru_omega_diagnostics {
  id                   String               @id
  diagnosticId         String               @unique
  operationId          String
  layerId              String
  diagnosticStatus     String               @default("pending")
  diagnosticResult     Json?
  runTimestamp         DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  gru_daily_operations gru_daily_operations @relation(fields: [operationId], references: [id], onDelete: Cascade)

  @@index([diagnosticId])
  @@index([diagnosticStatus])
  @@index([layerId])
  @@index([operationId])
}

model gru_omega_layer_finalities {
  id                       String                    @id
  finalityId               String                    @unique
  pipelineId               String?                   @unique
  omegaLayerId             String
  mergeOperationId         String?
  finalityProof            String?
  causalityStable          Boolean                   @default(false)
  multiRealityReconciled   Boolean                   @default(false)
  status                   String                    @default("pending")
  mergedAt                 DateTime?
  finalizedAt              DateTime?
  createdAt                DateTime                  @default(now())
  updatedAt                DateTime
  gru_settlement_pipelines gru_settlement_pipelines? @relation(fields: [pipelineId], references: [pipelineId], onDelete: Cascade)

  @@index([finalityId])
  @@index([omegaLayerId])
  @@index([pipelineId])
  @@index([status])
}

model gru_options {
  id                 String          @id
  optionId           String          @unique
  derivativeId       String          @unique
  optionType         String
  underlyingIndex    String
  strikePrice        Decimal         @db.Decimal(32, 12)
  premium            Decimal         @db.Decimal(32, 12)
  expirationDate     DateTime
  exerciseType       String
  settlementType     String
  settlementCurrency String
  quantity           Decimal         @db.Decimal(32, 8)
  intrinsicValue     Decimal?        @db.Decimal(32, 12)
  timeValue          Decimal?        @db.Decimal(32, 12)
  delta              Decimal?        @db.Decimal(32, 12)
  gamma              Decimal?        @db.Decimal(32, 12)
  theta              Decimal?        @db.Decimal(32, 12)
  vega               Decimal?        @db.Decimal(32, 12)
  exercisedAt        DateTime?
  createdAt          DateTime        @default(now())
  updatedAt          DateTime
  gru_derivatives    gru_derivatives @relation(fields: [derivativeId], references: [id], onDelete: Cascade)

  @@index([derivativeId])
  @@index([expirationDate])
  @@index([optionId])
  @@index([underlyingIndex])
}

model gru_quantum_envelope_keys {
  id                    String               @id
  qekId                 String               @unique
  operationId           String
  keyId                 String
  verificationStatus    String               @default("pending")
  verificationTimestamp DateTime?
  createdAt             DateTime             @default(now())
  updatedAt             DateTime
  gru_daily_operations  gru_daily_operations @relation(fields: [operationId], references: [id], onDelete: Cascade)

  @@index([keyId])
  @@index([operationId])
  @@index([qekId])
  @@index([verificationStatus])
}

model gru_regional_stabilization_funds {
  id                         String                     @id
  fundId                     String                     @unique
  reserveId                  String
  fundName                   String
  region                     String
  fundSize                   Decimal                    @db.Decimal(32, 8)
  availableFunds             Decimal                    @db.Decimal(32, 8)
  utilizationRate            Decimal?                   @db.Decimal(32, 8)
  status                     String                     @default("active")
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  gru_supranational_reserves gru_supranational_reserves @relation(fields: [reserveId], references: [id], onDelete: Cascade)

  @@index([fundId])
  @@index([region])
  @@index([reserveId])
  @@index([status])
}

model gru_regulatory_classifications {
  id                         String                     @id
  classificationId           String                     @unique
  entityId                   String
  entityType                 String
  regulatoryClass            String
  accessLevel                String
  eligibilityStatus          String                     @default("pending")
  eligibilityReviewDate      DateTime?
  reserveAdequacy            Boolean                    @default(false)
  legalRecognition           Boolean                    @default(false)
  ilieVerified               Boolean                    @default(false)
  status                     String                     @default("active")
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  gru_eligibility_reviews    gru_eligibility_reviews[]
  gru_supranational_entities gru_supranational_entities @relation(fields: [entityId], references: [id], onDelete: Cascade)

  @@index([classificationId])
  @@index([eligibilityStatus])
  @@index([entityId])
  @@index([regulatoryClass])
  @@index([status])
}

model gru_reserve_allocations {
  id                                String                              @id
  allocationId                      String                              @unique
  reserveId                         String
  sovereignBankId                   String
  allocationQuota                   Decimal                             @db.Decimal(32, 8)
  allocatedAmount                   Decimal                             @db.Decimal(32, 8)
  utilizationRate                   Decimal?                            @db.Decimal(32, 8)
  status                            String                              @default("active")
  allocatedAt                       DateTime                            @default(now())
  createdAt                         DateTime                            @default(now())
  updatedAt                         DateTime
  gru_supranational_reserves        gru_supranational_reserves          @relation(fields: [reserveId], references: [id], onDelete: Cascade)
  gru_reserve_pools                 gru_reserve_pools[]                 @relation("GruReserveAllocationToGruReservePool")
  gru_supranational_reserve_classes gru_supranational_reserve_classes[] @relation("GruReserveAllocationToGruSupranationalReserveClass")

  @@index([allocationId])
  @@index([reserveId])
  @@index([sovereignBankId])
  @@index([status])
}

model gru_reserve_bond_coupons {
  id                String            @id
  couponId          String            @unique
  bondId            String
  couponAmount      Decimal           @db.Decimal(32, 8)
  paymentDate       DateTime
  status            String            @default("pending")
  paidAt            DateTime?
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  gru_reserve_bonds gru_reserve_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([couponId])
  @@index([paymentDate])
  @@index([status])
}

model gru_reserve_bonds {
  id                       String                     @id
  bondId                   String                     @unique
  bondCode                 String                     @unique
  poolId                   String?
  entityId                 String?
  principalAmount          Decimal                    @db.Decimal(32, 8)
  maturityYears            Int
  maturityDate             DateTime
  interestRate             Decimal                    @db.Decimal(32, 8)
  couponRate               Decimal                    @db.Decimal(32, 8)
  couponFrequency          String
  bondType                 String
  status                   String                     @default("active")
  issuedAt                 DateTime                   @default(now())
  redeemedAt               DateTime?
  createdAt                DateTime                   @default(now())
  updatedAt                DateTime
  gru_reserve_bond_coupons gru_reserve_bond_coupons[]
  gru_reserve_pools        gru_reserve_pools?         @relation(fields: [poolId], references: [id])

  @@index([bondCode])
  @@index([bondId])
  @@index([entityId])
  @@index([maturityDate])
  @@index([poolId])
  @@index([status])
}

model gru_reserve_buffers {
  id              String    @id
  bufferId        String    @unique
  reserveType     String
  bufferAmount    Decimal   @db.Decimal(32, 8)
  allocatedAmount Decimal   @default(0) @db.Decimal(32, 8)
  availableAmount Decimal   @db.Decimal(32, 8)
  status          String    @default("active")
  lastAllocatedAt DateTime?
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([bufferId])
  @@index([reserveType])
  @@index([status])
}

model gru_reserve_certificates {
  id                String            @id
  certificateId     String            @unique
  certificateCode   String            @unique
  poolId            String
  allocationId      String
  amount            Decimal           @db.Decimal(32, 8)
  currencyCode      String?
  assetType         String?
  holderId          String
  holderType        String
  status            String            @default("active")
  issuedAt          DateTime          @default(now())
  redeemedAt        DateTime?
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  gru_reserve_pools gru_reserve_pools @relation(fields: [poolId], references: [id], onDelete: Cascade)

  @@index([allocationId])
  @@index([certificateCode])
  @@index([certificateId])
  @@index([holderId])
  @@index([poolId])
  @@index([status])
}

model gru_reserve_pools {
  id                            String                          @id
  poolId                        String                          @unique
  poolType                      String
  poolName                      String
  entityId                      String?
  totalReserves                 Decimal                         @default(0) @db.Decimal(32, 8)
  availableReserves             Decimal                         @default(0) @db.Decimal(32, 8)
  reservedReserves              Decimal                         @default(0) @db.Decimal(32, 8)
  currencyCode                  String?
  assetType                     String
  status                        String                          @default("active")
  lastUpdated                   DateTime                        @default(now())
  createdAt                     DateTime                        @default(now())
  updatedAt                     DateTime
  gru_reserve_bonds             gru_reserve_bonds[]
  gru_reserve_certificates      gru_reserve_certificates[]
  supranational_entities        supranational_entities?         @relation(fields: [entityId], references: [id])
  gru_reserve_withdrawals       gru_reserve_withdrawals[]
  gru_supranational_settlements gru_supranational_settlements[]
  gru_reserve_allocations       gru_reserve_allocations[]       @relation("GruReserveAllocationToGruReservePool")

  @@index([entityId])
  @@index([poolId])
  @@index([poolType])
  @@index([status])
}

model gru_reserve_withdrawals {
  id                String            @id
  withdrawalId      String            @unique
  poolId            String
  sovereignBankId   String?
  entityId          String?
  amount            Decimal           @db.Decimal(32, 8)
  currencyCode      String?
  withdrawalType    String
  approvalStatus    String            @default("pending")
  approvedAt        DateTime?
  executedAt        DateTime?
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  gru_reserve_pools gru_reserve_pools @relation(fields: [poolId], references: [id], onDelete: Cascade)

  @@index([entityId])
  @@index([poolId])
  @@index([sovereignBankId])
  @@index([withdrawalId])
}

model gru_risk_controls {
  id            String   @id
  controlId     String   @unique
  controlDate   DateTime @default(now())
  controlType   String
  controlStatus String   @default("pending")
  controlResult Json?
  createdAt     DateTime @default(now())
  updatedAt     DateTime

  @@index([controlDate])
  @@index([controlId])
  @@index([controlStatus])
  @@index([controlType])
}

model gru_sdr_alternatives {
  id               String   @id
  sdrId            String   @unique
  compositionType  String
  gruWeight        Decimal  @db.Decimal(32, 8)
  xauWeight        Decimal  @db.Decimal(32, 8)
  basketWeight     Decimal  @db.Decimal(32, 8)
  basketCurrencies Json
  baseValue        Decimal  @db.Decimal(32, 12)
  currentValue     Decimal  @db.Decimal(32, 12)
  status           String   @default("active")
  effectiveDate    DateTime @default(now())
  updatedAt        DateTime
  createdAt        DateTime @default(now())

  @@index([compositionType])
  @@index([sdrId])
  @@index([status])
}

model gru_sdr_instruments {
  id                   String                 @id
  sdrId                String                 @unique
  sdrName              String                 @default("SDR_GRU")
  gruWeight            Decimal                @default(0.40) @db.Decimal(32, 8)
  xauWeight            Decimal                @default(0.30) @db.Decimal(32, 8)
  fxBasketWeight       Decimal                @default(0.30) @db.Decimal(32, 8)
  composition          Json
  currentValue         Decimal                @db.Decimal(32, 12)
  valuationDate        DateTime               @default(now())
  fxBasket             Json
  status               String                 @default("active")
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  gru_sdr_transactions gru_sdr_transactions[]
  gru_sdr_valuations   gru_sdr_valuations[]

  @@index([sdrId])
  @@index([status])
  @@index([valuationDate])
}

model gru_sdr_transactions {
  id                  String              @id
  transactionId       String              @unique
  sdrId               String
  transactionType     String
  amount              Decimal             @db.Decimal(32, 8)
  sourceCurrency      String?
  targetCurrency      String?
  conversionRate      Decimal?            @db.Decimal(32, 12)
  status              String              @default("pending")
  completedAt         DateTime?
  createdAt           DateTime            @default(now())
  updatedAt           DateTime
  gru_sdr_instruments gru_sdr_instruments @relation(fields: [sdrId], references: [id], onDelete: Cascade)

  @@index([sdrId])
  @@index([status])
  @@index([transactionId])
  @@index([transactionType])
}

model gru_sdr_valuations {
  id                  String              @id
  valuationId         String              @unique
  sdrId               String
  gruValue            Decimal             @db.Decimal(32, 12)
  xauValue            Decimal             @db.Decimal(32, 12)
  fxBasketValue       Decimal             @db.Decimal(32, 12)
  totalValue          Decimal             @db.Decimal(32, 12)
  valuationDate       DateTime            @default(now())
  metadata            Json?
  createdAt           DateTime            @default(now())
  gru_sdr_instruments gru_sdr_instruments @relation(fields: [sdrId], references: [id], onDelete: Cascade)

  @@index([sdrId])
  @@index([valuationDate])
  @@index([valuationId])
}

model gru_settlement_pipelines {
  id                         String                      @id
  pipelineId                 String                      @unique
  issuanceId                 String?
  applicationId              String?
  pipelineStage              String                      @default("classical")
  classicalState             Json?
  quantumState               Json?
  omegaLayerState            Json?
  gasSettlementId            String?
  omegaFinalityId            String?
  status                     String                      @default("pending")
  initiatedAt                DateTime                    @default(now())
  completedAt                DateTime?
  createdAt                  DateTime                    @default(now())
  updatedAt                  DateTime
  gru_gas_settlements        gru_gas_settlements?
  gru_omega_layer_finalities gru_omega_layer_finalities?
  gru_issuances              gru_issuances?              @relation(fields: [issuanceId], references: [id])

  @@index([applicationId])
  @@index([issuanceId])
  @@index([pipelineId])
  @@index([pipelineStage])
  @@index([status])
}

model gru_sovereign_correlations {
  id                String   @id
  correlationId     String   @unique
  correlationDate   DateTime @default(now())
  sovereignBankId1  String
  sovereignBankId2  String
  correlationValue  Decimal  @db.Decimal(32, 8)
  correlationStatus String   @default("normal")
  createdAt         DateTime @default(now())
  updatedAt         DateTime

  @@index([correlationDate])
  @@index([correlationId])
  @@index([sovereignBankId1])
  @@index([sovereignBankId2])
}

model gru_stress_regimes {
  id               String             @id
  regimeId         String             @unique
  regimeName       String
  regimeType       String
  description      String
  parameters       Json
  severity         String
  status           String             @default("active")
  createdAt        DateTime           @default(now())
  updatedAt        DateTime
  gru_stress_tests gru_stress_tests[]

  @@index([regimeId])
  @@index([regimeType])
  @@index([severity])
}

model gru_stress_test_results {
  id               String           @id
  resultId         String           @unique
  testId           String
  testName         String
  stressRegime     String
  metricName       String
  metricValue      Decimal          @db.Decimal(32, 12)
  threshold        Decimal?         @db.Decimal(32, 12)
  passed           Boolean?
  impactLevel      String?
  details          Json?
  timestamp        DateTime         @default(now())
  temporalOffset   Int?
  createdAt        DateTime         @default(now())
  gru_stress_tests gru_stress_tests @relation(fields: [testId], references: [id], onDelete: Cascade)

  @@index([metricName])
  @@index([resultId])
  @@index([stressRegime])
  @@index([testId])
  @@index([timestamp])
}

model gru_stress_tests {
  id                      String                    @id
  testId                  String                    @unique
  testName                String
  regimeId                String?
  stressRegime            String
  testType                String
  sovereignBankId         String?
  parameters              Json
  status                  String                    @default("running")
  startedAt               DateTime                  @default(now())
  completedAt             DateTime?
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  gru_stress_test_results gru_stress_test_results[]
  gru_stress_regimes      gru_stress_regimes?       @relation(fields: [regimeId], references: [id])

  @@index([sovereignBankId])
  @@index([status])
  @@index([stressRegime])
  @@index([testId])
  @@index([testType])
}

model gru_supranational_entities {
  id                             String                           @id
  entityId                       String                           @unique
  entityName                     String
  entityType                     String
  region                         String?
  memberSovereigns               Json?
  ilieIdentityId                 String?
  status                         String                           @default("active")
  createdAt                      DateTime                         @default(now())
  updatedAt                      DateTime
  gru_issuance_applications      gru_issuance_applications[]
  gru_regulatory_classifications gru_regulatory_classifications[]

  @@index([entityId])
  @@index([entityType])
  @@index([status])
}

model gru_supranational_reserve_classes {
  id                      String                    @id
  reserveClassId          String                    @unique
  classType               String                    @unique
  className               String
  description             String
  roles                   Json
  functions               Json
  entityId                String?
  status                  String                    @default("active")
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  supranational_entities  supranational_entities?   @relation(fields: [entityId], references: [id])
  gru_reserve_allocations gru_reserve_allocations[] @relation("GruReserveAllocationToGruSupranationalReserveClass")

  @@index([classType])
  @@index([entityId])
  @@index([reserveClassId])
  @@index([status])
}

model gru_supranational_reserves {
  id                               String                             @id
  reserveId                        String                             @unique
  reserveClass                     String
  reserveName                      String
  reserveType                      String
  jurisdiction                     String?
  totalReserves                    Decimal                            @db.Decimal(32, 8)
  allocatedReserves                Decimal                            @db.Decimal(32, 8)
  availableReserves                Decimal                            @db.Decimal(32, 8)
  status                           String                             @default("active")
  createdAt                        DateTime                           @default(now())
  updatedAt                        DateTime
  gru_regional_stabilization_funds gru_regional_stabilization_funds[]
  gru_reserve_allocations          gru_reserve_allocations[]

  @@index([jurisdiction])
  @@index([reserveClass])
  @@index([reserveId])
  @@index([reserveType])
  @@index([status])
}

model gru_supranational_settlements {
  id                 String            @id
  settlementId       String            @unique
  poolId             String
  atomicSettlementId String?
  gruIndexState      Json
  xauState           Json
  regionalFxBasket   Json
  omegaLayerState    Json?
  gasConfirmation    String?
  gqlTruthSample     String?
  settlementAmount   Decimal           @db.Decimal(32, 8)
  currencyCode       String
  status             String            @default("pending")
  mergedAt           DateTime?
  confirmedAt        DateTime?
  createdAt          DateTime          @default(now())
  updatedAt          DateTime
  gru_reserve_pools  gru_reserve_pools @relation(fields: [poolId], references: [id], onDelete: Cascade)

  @@index([atomicSettlementId])
  @@index([poolId])
  @@index([settlementId])
  @@index([status])
}

model gru_swap_payments {
  id                String    @id
  paymentId         String    @unique
  swapId            String
  paymentDate       DateTime
  paymentAmount     Decimal   @db.Decimal(32, 8)
  fixedLegAmount    Decimal   @db.Decimal(32, 8)
  floatingLegAmount Decimal   @db.Decimal(32, 8)
  netAmount         Decimal   @db.Decimal(32, 8)
  status            String    @default("pending")
  paidAt            DateTime?
  createdAt         DateTime  @default(now())
  updatedAt         DateTime
  gru_swaps         gru_swaps @relation(fields: [swapId], references: [id], onDelete: Cascade)

  @@index([paymentDate])
  @@index([paymentId])
  @@index([status])
  @@index([swapId])
}

model gru_swaps {
  id                String              @id
  swapId            String              @unique
  derivativeId      String              @unique
  swapType          String
  fixedRate         Decimal             @db.Decimal(32, 12)
  floatingRateIndex String
  paymentFrequency  String
  notionalAmount    Decimal             @db.Decimal(32, 8)
  nextPaymentDate   DateTime
  maturityDate      DateTime
  lastResetDate     DateTime?
  accruedInterest   Decimal?            @db.Decimal(32, 8)
  createdAt         DateTime            @default(now())
  updatedAt         DateTime
  gru_swap_payments gru_swap_payments[]
  gru_derivatives   gru_derivatives     @relation(fields: [derivativeId], references: [id], onDelete: Cascade)

  @@index([derivativeId])
  @@index([maturityDate])
  @@index([swapId])
  @@index([swapType])
}

model gru_synthetic_market_flags {
  id          String    @id
  flagId      String    @unique
  flagDate    DateTime  @default(now())
  marketType  String
  stressLevel String    @default("normal")
  flagReason  String
  status      String    @default("active")
  resolvedAt  DateTime?
  createdAt   DateTime  @default(now())
  updatedAt   DateTime

  @@index([flagDate])
  @@index([flagId])
  @@index([marketType])
  @@index([status])
  @@index([stressLevel])
}

model gru_temporal_settlements {
  id                  String                @id
  settlementId        String                @unique
  sourceBankId        String
  destinationBankId   String
  amount              Decimal               @db.Decimal(32, 8)
  currencyCode        String
  gruUnitId           String?
  settlementType      String
  temporalState       String
  temporalOffset      Int?
  classicalState      Json?
  retroState          Json?
  futureState         Json?
  omegaState          Json?
  mergedState         Json?
  status              String                @default("pending")
  settledAt           DateTime?
  createdAt           DateTime              @default(now())
  updatedAt           DateTime
  gru_chrono_fx       gru_chrono_fx[]
  gru_temporal_states gru_temporal_states[]

  @@index([destinationBankId])
  @@index([settlementId])
  @@index([sourceBankId])
  @@index([status])
  @@index([temporalState])
}

model gru_temporal_states {
  id                       String                   @id
  stateId                  String                   @unique
  settlementId             String
  temporalState            String
  temporalOffset           Int?
  stateData                Json
  stateHash                String
  verified                 Boolean                  @default(false)
  verifiedAt               DateTime?
  createdAt                DateTime                 @default(now())
  gru_temporal_settlements gru_temporal_settlements @relation(fields: [settlementId], references: [id], onDelete: Cascade)

  @@index([settlementId])
  @@index([stateHash])
  @@index([stateId])
  @@index([temporalState])
}

model gru_transparency_reports {
  id          String    @id
  reportId    String    @unique
  reportType  String
  reportDate  DateTime  @default(now())
  reportData  Json
  status      String    @default("generated")
  publishedAt DateTime?
  createdAt   DateTime  @default(now())
  updatedAt   DateTime

  @@index([reportDate])
  @@index([reportId])
  @@index([reportType])
  @@index([status])
}

model gru_triangulations {
  id                  String    @id
  triangulationId     String    @unique
  gruUnitId           String
  gruAmount           Decimal   @db.Decimal(32, 8)
  gruType             String
  xauValue            Decimal   @db.Decimal(32, 8)
  targetValue         Decimal   @db.Decimal(32, 8)
  targetAssetType     String
  targetCurrencyCode  String?
  targetCommodityType String?
  triangulationRate   Decimal   @db.Decimal(32, 12)
  status              String    @default("completed")
  createdAt           DateTime  @default(now())
  updatedAt           DateTime
  gru_units           gru_units @relation(fields: [gruUnitId], references: [id], onDelete: Cascade)

  @@index([gruUnitId])
  @@index([status])
  @@index([targetAssetType])
  @@index([triangulationId])
}

model gru_units {
  id                 String               @id
  gruUnitId          String               @unique
  sovereignBankId    String
  unitType           String
  amount             Decimal              @db.Decimal(32, 8)
  status             String               @default("active")
  createdAt          DateTime             @default(now())
  updatedAt          DateTime
  gru_bonds          gru_bonds[]
  gru_triangulations gru_triangulations[]

  @@index([gruUnitId])
  @@index([sovereignBankId])
  @@index([status])
  @@index([unitType])
}

model gru_volatility_screening {
  id               String   @id
  screeningId      String   @unique
  screeningDate    DateTime @default(now())
  indexCode        String
  volatilityLevel  Decimal  @db.Decimal(32, 8)
  volatilityStatus String   @default("normal")
  threshold        Decimal? @db.Decimal(32, 8)
  createdAt        DateTime @default(now())
  updatedAt        DateTime

  @@index([indexCode])
  @@index([screeningDate])
  @@index([screeningId])
  @@index([volatilityStatus])
}

model gru_yield_curve_points {
  id               String           @id
  pointId          String           @unique
  curveId          String
  maturityMonths   Int
  yield            Decimal          @db.Decimal(32, 12)
  discountFactor   Decimal?         @db.Decimal(32, 12)
  forwardRate      Decimal?         @db.Decimal(32, 12)
  timestamp        DateTime         @default(now())
  createdAt        DateTime         @default(now())
  gru_yield_curves gru_yield_curves @relation(fields: [curveId], references: [id], onDelete: Cascade)

  @@index([curveId])
  @@index([maturityMonths])
  @@index([pointId])
}

model gru_yield_curves {
  id                     String                   @id
  curveId                String                   @unique
  curveType              String
  curveName              String
  effectiveDate          DateTime                 @default(now())
  maturityPoints         Json
  interpolationMethod    String                   @default("linear")
  status                 String                   @default("active")
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  gru_yield_curve_points gru_yield_curve_points[]

  @@index([curveId])
  @@index([curveType])
  @@index([effectiveDate])
  @@index([status])
}

model gsds_pricing_engine {
  id                    String                @id
  pricingId             String                @unique
  derivativeId          String
  baseValue             Decimal               @db.Decimal(32, 12)
  volatilityFactor      Decimal               @db.Decimal(32, 12)
  collateralRatio       Decimal               @db.Decimal(32, 12)
  liquidityPenalty      Decimal               @db.Decimal(32, 12)
  sriAdjustment         Decimal               @db.Decimal(32, 12)
  syntheticPrice        Decimal               @db.Decimal(32, 12)
  pricingSource         String
  calculatedAt          DateTime              @default(now())
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  synthetic_derivatives synthetic_derivatives @relation(fields: [derivativeId], references: [id], onDelete: Cascade)

  @@index([calculatedAt])
  @@index([derivativeId])
  @@index([pricingId])
}

model gss_layers {
  id          String   @id
  layerId     String   @unique
  layerNumber Int
  layerName   String
  description String
  status      String   @default("active")
  createdAt   DateTime @default(now())
  updatedAt   DateTime

  @@index([layerId])
  @@index([layerNumber])
}

model gss_master_ledger {
  id                         String                     @id
  entryId                    String                     @unique
  nodeId                     String
  sourceBankId               String
  destinationBankId          String
  amount                     Decimal                    @db.Decimal(32, 8)
  currencyCode               String
  assetType                  String
  sovereignSignature         String?
  dbisSignature              String?
  dualLedgerCommit           Boolean                    @default(false)
  sovereignLedgerHash        String?
  dbisLedgerHash             String?
  status                     String                     @default("pending")
  committedAt                DateTime?
  settledAt                  DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  sovereign_settlement_nodes sovereign_settlement_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([committedAt])
  @@index([destinationBankId])
  @@index([entryId])
  @@index([nodeId])
  @@index([sourceBankId])
  @@index([status])
}

model harmonization_compliance {
  id              String   @id
  sovereignBankId String
  pillar          String
  complianceScore Decimal  @db.Decimal(5, 2)
  lastAssessment  DateTime
  nextAssessment  DateTime
  issues          String[]
  status          String   @default("COMPLIANT")
  createdAt       DateTime @default(now())
  updatedAt       DateTime

  @@index([pillar])
  @@index([sovereignBankId])
  @@index([status])
}

model holographic_anchors {
  id                      String                    @id
  anchorId                String                    @unique
  sovereignBankId         String?
  sovereignId             String?
  assetId                 String?
  anchorType              String
  encodedAnchor           String
  sovereignIdentity       Json?
  ledgerState             Json?
  reflectionState         Json?
  multiverseAlignment     Json?
  integrityStatus         String                    @default("pending")
  verifiedAt              DateTime?
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  anchor_integrity_checks anchor_integrity_checks[]
  sovereign_banks         sovereign_banks?          @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
  holographic_settlements holographic_settlements[]

  @@index([anchorId])
  @@index([anchorType])
  @@index([assetId])
  @@index([integrityStatus])
  @@index([sovereignBankId])
  @@index([sovereignId])
}

model holographic_bond_coupons {
  id                String            @id
  couponId          String            @unique
  bondId            String
  couponAmount      Decimal           @db.Decimal(32, 8)
  paymentDate       DateTime
  status            String            @default("pending")
  paidAt            DateTime?
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  holographic_bonds holographic_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([couponId])
  @@index([status])
}

model holographic_bonds {
  id                       String                     @id
  bondId                   String                     @unique
  bondName                 String
  principalAmount          Decimal                    @db.Decimal(32, 8)
  holographicEconomyId     String
  simulatedEconomyId       String?
  certificateHash          String
  holographicData          Json?
  maturityDate             DateTime
  couponRate               Decimal                    @db.Decimal(32, 8)
  status                   String                     @default("active")
  issuedAt                 DateTime                   @default(now())
  createdAt                DateTime                   @default(now())
  updatedAt                DateTime
  holographic_bond_coupons holographic_bond_coupons[]

  @@index([bondId])
  @@index([holographicEconomyId])
  @@index([simulatedEconomyId])
  @@index([status])
}

model holographic_economic_states {
  id                    String                  @id
  stateId               String                  @unique
  stateHash             String                  @unique
  cbdcFlow              Json
  fxMatrix              Json
  ssuPressure           Json
  stabilityFields       Json
  encodedState          Json
  timestamp             DateTime                @default(now())
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  deviation_corrections deviation_corrections[]
  economic_projections  economic_projections[]
  holographic_mappings  holographic_mappings[]

  @@index([stateHash])
  @@index([stateId])
  @@index([timestamp])
}

model holographic_mappings {
  id                          String                      @id
  mappingId                   String                      @unique
  stateId                     String
  sourceReality               String
  targetReality               String
  mappingData                 Json
  mappingType                 String
  status                      String                      @default("active")
  createdAt                   DateTime                    @default(now())
  updatedAt                   DateTime
  holographic_economic_states holographic_economic_states @relation(fields: [stateId], references: [id], onDelete: Cascade)

  @@index([mappingId])
  @@index([sourceReality])
  @@index([stateId])
  @@index([targetReality])
}

model holographic_settlements {
  id                  String              @id
  settlementId        String              @unique
  anchorId            String
  settlementType      String
  settlementData      Json
  holographicCheck    Boolean             @default(false)
  finalityStatus      String              @default("pending")
  finalizedAt         DateTime?
  createdAt           DateTime            @default(now())
  updatedAt           DateTime
  holographic_anchors holographic_anchors @relation(fields: [anchorId], references: [id], onDelete: Cascade)

  @@index([anchorId])
  @@index([finalityStatus])
  @@index([settlementId])
}

model hsmn_binding_laws {
  id                  String              @id
  bindingId           String              @unique
  sovereignBankId     String
  identityHash        String
  unified             Boolean             @default(false)
  identityInvariant   Boolean             @default(false)
  ledgerTruth         Boolean             @default(false)
  temporalConsistency Boolean             @default(false)
  quantumCoherence    Boolean             @default(false)
  status              String              @default("unbound")
  createdAt           DateTime            @default(now())
  updatedAt           DateTime
  hsmn_nexus_layers   hsmn_nexus_layers[] @relation("HsmnBindingLawToHsmnNexusLayer")

  @@index([bindingId])
  @@index([identityHash])
  @@index([sovereignBankId])
  @@index([status])
}

model hsmn_nexus_layers {
  id                      String                    @id
  nexusId                 String                    @unique
  layerNumber             Int
  layerName               String
  description             String
  anchorValue             Decimal?                  @db.Decimal(32, 12)
  stabilityIndex          Decimal?                  @db.Decimal(32, 12)
  status                  String                    @default("active")
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  hsmn_reality_states     hsmn_reality_states[]
  hsmn_sovereign_mappings hsmn_sovereign_mappings[]
  hsmn_binding_laws       hsmn_binding_laws[]       @relation("HsmnBindingLawToHsmnNexusLayer")

  @@index([layerNumber])
  @@index([nexusId])
  @@index([status])
}

model hsmn_reality_states {
  id                String            @id
  stateId           String            @unique
  nexusLayerId      String
  sovereignBankId   String
  realityType       String
  timeline          String?
  stateData         Json
  status            String            @default("active")
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  hsmn_nexus_layers hsmn_nexus_layers @relation(fields: [nexusLayerId], references: [id], onDelete: Cascade)

  @@index([nexusLayerId])
  @@index([realityType])
  @@index([sovereignBankId])
  @@index([stateId])
  @@index([status])
}

model hsmn_sovereign_mappings {
  id                String            @id
  mappingId         String            @unique
  nexusLayerId      String
  sovereignBankId   String
  realityBranch     String?
  parallelState     String?
  identityHash      String
  bindingStatus     String            @default("bound")
  status            String            @default("active")
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  hsmn_nexus_layers hsmn_nexus_layers @relation(fields: [nexusLayerId], references: [id], onDelete: Cascade)

  @@index([identityHash])
  @@index([mappingId])
  @@index([nexusLayerId])
  @@index([realityBranch])
  @@index([sovereignBankId])
  @@index([status])
}

model identity_corrections {
  id                        String                    @id
  correctionId              String                    @unique
  identityId                String
  correctionType            String
  beforeState               Json
  afterState                Json
  correctionDetails         Json?
  status                    String                    @default("pending")
  appliedAt                 DateTime?
  createdAt                 DateTime                  @default(now())
  updatedAt                 DateTime
  infinite_layer_identities infinite_layer_identities @relation(fields: [identityId], references: [id], onDelete: Cascade)

  @@index([correctionId])
  @@index([identityId])
  @@index([status])
}

model identity_layers {
  id                        String                    @id
  layerId                   String                    @unique
  identityId                String
  layerNumber               Int
  layerType                 String
  layerIdentity             String
  layerMetadata             Json?
  status                    String                    @default("active")
  createdAt                 DateTime                  @default(now())
  updatedAt                 DateTime
  infinite_layer_identities infinite_layer_identities @relation(fields: [identityId], references: [id], onDelete: Cascade)

  @@index([identityId])
  @@index([layerId])
  @@index([layerNumber])
  @@index([layerType])
}

model infinite_layer_identities {
  id                   String                 @id
  identityId           String                 @unique
  sovereignBankId      String?
  entityType           String
  entityId             String
  unifiedIdentity      String
  identityDrift        Decimal                @default(0) @db.Decimal(32, 12)
  driftThreshold       Decimal                @default(0.01) @db.Decimal(32, 12)
  status               String                 @default("active")
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  lastCorrectionAt     DateTime?
  identity_corrections identity_corrections[]
  identity_layers      identity_layers[]
  sovereign_banks      sovereign_banks?       @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([entityId])
  @@index([entityType])
  @@index([identityId])
  @@index([sovereignBankId])
  @@index([status])
}

model infinite_state_reserves {
  id                        String                      @id
  reserveId                 String                      @unique
  reserveName               String
  classicalReserve          Decimal                     @db.Decimal(32, 12)
  quantumReserve            Decimal?                    @db.Decimal(32, 12)
  parallelReserve           Decimal?                    @db.Decimal(32, 12)
  holographicReserve        Decimal?                    @db.Decimal(32, 12)
  temporalReserve           Decimal?                    @db.Decimal(32, 12)
  totalReserve              Decimal                     @db.Decimal(32, 12)
  variance                  Decimal?                    @db.Decimal(32, 12)
  entropy                   Decimal?                    @db.Decimal(32, 12)
  status                    String                      @default("active")
  calculatedAt              DateTime                    @default(now())
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime
  parallel_reserve_branches parallel_reserve_branches[]
  quantum_reserve_states    quantum_reserve_states[]
  temporal_reserve_futures  temporal_reserve_futures[]

  @@index([calculatedAt])
  @@index([reserveId])
  @@index([status])
}

model interbank_credit_lines {
  id                 String          @id
  sovereignBankId    String
  counterpartyBankId String
  creditLimit        Decimal         @db.Decimal(32, 8)
  usedAmount         Decimal         @default(0) @db.Decimal(32, 8)
  availableAmount    Decimal         @db.Decimal(32, 8)
  currencyCode       String
  status             String          @default("active")
  expiryDate         DateTime?
  createdAt          DateTime        @default(now())
  updatedAt          DateTime
  sovereign_banks    sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([counterpartyBankId])
  @@index([sovereignBankId])
}

model interdimensional_ledgers {
  id                        String                      @id
  ledgerId                  String                      @unique
  ledgerName                String
  dimension                 String
  dimensionType             String
  description               String
  ledgerState               Json?
  status                    String                      @default("active")
  lastSyncAt                DateTime?
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime
  dimension_reconciliations dimension_reconciliations[]
  ledger_dimensions         ledger_dimensions[]

  @@index([dimensionType])
  @@index([dimension])
  @@index([ledgerId])
  @@index([status])
}

model interplanetary_cbdc {
  id                   String               @id
  icbdcId              String               @unique
  nodeId               String
  currencyCode         String
  amount               Decimal              @db.Decimal(32, 8)
  issuanceType         String
  sovereignAutonomy    Boolean              @default(true)
  dualLedgerFinality   Boolean              @default(false)
  status               String               @default("active")
  issuedAt             DateTime             @default(now())
  redeemedAt           DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  interplanetary_nodes interplanetary_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([currencyCode])
  @@index([icbdcId])
  @@index([nodeId])
  @@index([status])
}

model interplanetary_nodes {
  id                                                                                       String                       @id
  nodeId                                                                                   String                       @unique
  planetaryLocation                                                                        String
  sovereignBankId                                                                          String?
  nodeType                                                                                 String
  nodeName                                                                                 String
  nodeAddress                                                                              String
  status                                                                                   String                       @default("active")
  createdAt                                                                                DateTime                     @default(now())
  updatedAt                                                                                DateTime
  interplanetary_cbdc                                                                      interplanetary_cbdc[]
  interplanetary_relay_grid_interplanetary_relay_grid_sourceNodeIdTointerplanetary_nodes   interplanetary_relay_grid[]  @relation("interplanetary_relay_grid_sourceNodeIdTointerplanetary_nodes")
  interplanetary_relay_grid_interplanetary_relay_grid_targetNodeIdTointerplanetary_nodes   interplanetary_relay_grid[]  @relation("interplanetary_relay_grid_targetNodeIdTointerplanetary_nodes")
  interplanetary_settlements_interplanetary_settlements_sourceNodeIdTointerplanetary_nodes interplanetary_settlements[] @relation("interplanetary_settlements_sourceNodeIdTointerplanetary_nodes")
  interplanetary_settlements_interplanetary_settlements_targetNodeIdTointerplanetary_nodes interplanetary_settlements[] @relation("interplanetary_settlements_targetNodeIdTointerplanetary_nodes")
  interplanetary_ssu                                                                       interplanetary_ssu[]

  @@index([nodeId])
  @@index([planetaryLocation])
  @@index([sovereignBankId])
  @@index([status])
}

model interplanetary_relay_grid {
  id                                                                                String               @id
  relayId                                                                           String               @unique
  sourceNodeId                                                                      String
  targetNodeId                                                                      String
  relayType                                                                         String
  messageType                                                                       String
  messagePayload                                                                    Json
  pqcSignature                                                                      String?
  latency                                                                           Int?
  highLatencyBuffer                                                                 Boolean              @default(false)
  status                                                                            String               @default("pending")
  relayedAt                                                                         DateTime?
  deliveredAt                                                                       DateTime?
  createdAt                                                                         DateTime             @default(now())
  updatedAt                                                                         DateTime
  interplanetary_nodes_interplanetary_relay_grid_sourceNodeIdTointerplanetary_nodes interplanetary_nodes @relation("interplanetary_relay_grid_sourceNodeIdTointerplanetary_nodes", fields: [sourceNodeId], references: [id], onDelete: Cascade)
  interplanetary_nodes_interplanetary_relay_grid_targetNodeIdTointerplanetary_nodes interplanetary_nodes @relation("interplanetary_relay_grid_targetNodeIdTointerplanetary_nodes", fields: [targetNodeId], references: [id], onDelete: Cascade)

  @@index([relayId])
  @@index([sourceNodeId])
  @@index([status])
  @@index([targetNodeId])
}

model interplanetary_settlements {
  id                                                                                 String                      @id
  settlementId                                                                       String                      @unique
  sourceNodeId                                                                       String
  targetNodeId                                                                       String
  amount                                                                             Decimal                     @db.Decimal(32, 8)
  currencyCode                                                                       String
  assetType                                                                          String
  settlementType                                                                     String
  hashLock                                                                           String?
  status                                                                             String                      @default("pending")
  committedAt                                                                        DateTime?
  settledAt                                                                          DateTime?
  finalizedAt                                                                        DateTime?
  createdAt                                                                          DateTime                    @default(now())
  updatedAt                                                                          DateTime
  interplanetary_nodes_interplanetary_settlements_sourceNodeIdTointerplanetary_nodes interplanetary_nodes        @relation("interplanetary_settlements_sourceNodeIdTointerplanetary_nodes", fields: [sourceNodeId], references: [id], onDelete: Cascade)
  interplanetary_nodes_interplanetary_settlements_targetNodeIdTointerplanetary_nodes interplanetary_nodes        @relation("interplanetary_settlements_targetNodeIdTointerplanetary_nodes", fields: [targetNodeId], references: [id], onDelete: Cascade)
  temporal_settlement_engine                                                         temporal_settlement_engine?

  @@index([settlementId])
  @@index([sourceNodeId])
  @@index([status])
  @@index([targetNodeId])
}

model interplanetary_ssu {
  id                   String               @id
  issuId               String               @unique
  nodeId               String
  amount               Decimal              @db.Decimal(32, 8)
  gravityAdjustment    Decimal?             @db.Decimal(32, 12)
  radiationEnvelope    String?
  status               String               @default("active")
  issuedAt             DateTime             @default(now())
  redeemedAt           DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  interplanetary_nodes interplanetary_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([issuId])
  @@index([nodeId])
  @@index([status])
}

model interplanetary_ssu_transactions {
  id                  String              @id
  transactionId       String              @unique
  issuId              String
  sovereignBankId     String
  amount              Decimal             @db.Decimal(32, 12)
  originPlanet        String
  destinationPlanet   String
  settlementMode      String
  status              String              @default("pending")
  executedAt          DateTime?
  createdAt           DateTime            @default(now())
  updatedAt           DateTime
  interplanetary_ssus interplanetary_ssus @relation(fields: [issuId], references: [id], onDelete: Cascade)
  sovereign_banks     sovereign_banks     @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([issuId])
  @@index([sovereignBankId])
  @@index([status])
  @@index([transactionId])
}

model interplanetary_ssus {
  id                              String                            @id
  issuId                          String                            @unique
  issuCode                        String                            @unique
  description                     String
  basePlanet                      String?
  composition                     Json?
  conversionRate                  Decimal?                          @db.Decimal(32, 12)
  status                          String                            @default("active")
  createdAt                       DateTime                          @default(now())
  updatedAt                       DateTime
  interplanetary_ssu_transactions interplanetary_ssu_transactions[]

  @@index([issuCode])
  @@index([issuId])
  @@index([status])
}

model iso_messages {
  id              String          @id
  messageId       String          @unique
  sovereignBankId String
  messageType     String
  direction       String
  status          String          @default("pending")
  rawMessage      String
  parsedData      Json?
  dbisExtensions  Json?
  hsmSignature    String?
  createdAt       DateTime        @default(now())
  processedAt     DateTime?
  acknowledgedAt  DateTime?
  sovereign_banks sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([createdAt])
  @@index([messageId])
  @@index([messageType])
  @@index([sovereignBankId])
  @@index([status])
}

model ledger_anomalies {
  id                               String                            @id
  anomalyId                        String                            @unique
  sgseId                           String?
  ledgerId                         String
  anomalyType                      String
  severity                         String
  detectedAt                       DateTime                          @default(now())
  remediatedAt                     DateTime?
  remediationAction                String?
  status                           String                            @default("detected")
  metadata                         Json?
  createdAt                        DateTime                          @default(now())
  updatedAt                        DateTime
  sovereign_graph_security_engines sovereign_graph_security_engines? @relation(fields: [sgseId], references: [id])

  @@index([anomalyId])
  @@index([anomalyType])
  @@index([ledgerId])
  @@index([sgseId])
  @@index([status])
}

model ledger_dimensions {
  id                       String                   @id
  dimensionId              String                   @unique
  ledgerId                 String
  dimensionCode            String
  dimensionName            String
  dimensionMetadata        Json
  status                   String                   @default("active")
  createdAt                DateTime                 @default(now())
  updatedAt                DateTime
  interdimensional_ledgers interdimensional_ledgers @relation(fields: [ledgerId], references: [id], onDelete: Cascade)

  @@index([dimensionCode])
  @@index([dimensionId])
  @@index([ledgerId])
}

model ledger_entries {
  id                                                          String        @id
  ledgerId                                                    String
  debitAccountId                                              String
  creditAccountId                                             String
  amount                                                      Decimal       @db.Decimal(32, 8)
  currencyCode                                                String
  fxRate                                                      Decimal?      @db.Decimal(32, 12)
  assetType                                                   String        @default("fiat")
  transactionType                                             String
  referenceId                                                 String
  timestampUtc                                                DateTime      @default(now())
  blockHash                                                   String
  previousHash                                                String?
  auditFlag                                                   Boolean       @default(false)
  amlRiskScore                                                Int?          @default(0)
  status                                                      String        @default("pending")
  metadata                                                    Json?
  createdAt                                                   DateTime      @default(now())
  updatedAt                                                   DateTime
  bank_accounts_ledger_entries_creditAccountIdTobank_accounts bank_accounts @relation("ledger_entries_creditAccountIdTobank_accounts", fields: [creditAccountId], references: [id])
  bank_accounts_ledger_entries_debitAccountIdTobank_accounts  bank_accounts @relation("ledger_entries_debitAccountIdTobank_accounts", fields: [debitAccountId], references: [id])

  @@index([blockHash])
  @@index([ledgerId])
  @@index([referenceId])
  @@index([status])
  @@index([timestampUtc])
  @@index([transactionType])
}

/// SAL: inventory per asset per chain (wallets, vaults, pools).
model sal_positions {
  id           String   @id
  accountId    String   // wallet_id, vault_id, or bank_account id
  asset        String   // token address or "native"
  chainId      Int      // 138, 651940, 1, etc.
  balance      Decimal  @db.Decimal(32, 18)
  updatedAt    DateTime @updatedAt
  createdAt    DateTime @default(now())

  @@unique([accountId, asset, chainId])
  @@index([accountId])
  @@index([chainId])
  @@index([asset])
}

/// SAL: gas and protocol fees per chain/tx.
model sal_fees {
  id           String   @id
  referenceId  String   // intent_id or execution_id
  chainId      Int
  txHash       String?  // on-chain tx hash
  feeType      String   // gas, protocol
  amount       Decimal  @db.Decimal(32, 18)
  currencyCode String   @default("native")
  createdAt    DateTime @default(now())

  @@index([referenceId])
  @@index([chainId])
  @@index([txHash])
}

/// SAL: reconciliation snapshots (on-chain balance vs ledger).
model sal_reconciliation_snapshots {
  id            String   @id
  accountId     String
  asset         String
  chainId       Int
  salBalance    Decimal  @db.Decimal(32, 18)
  onChainBalance Decimal? @db.Decimal(32, 18)
  blockNumber   BigInt?
  discrepancy  Decimal?  @db.Decimal(32, 18) // onChain - sal
  status        String   @default("ok") // ok, discrepancy, error
  createdAt     DateTime @default(now())

  @@index([accountId])
  @@index([chainId])
  @@index([createdAt])
}

model legacy_protocol_mappings {
  id             String   @id
  mappingId      String   @unique
  legacyProtocol String
  mappingConfig  Json
  status         String   @default("active")
  createdAt      DateTime @default(now())
  updatedAt      DateTime

  @@index([legacyProtocol])
  @@index([mappingId])
  @@index([status])
}

model letters_of_credit {
  id                String   @id
  lcId              String   @unique
  applicantBankId   String
  beneficiaryBankId String
  amount            Decimal  @db.Decimal(32, 8)
  currencyCode      String
  expiryDate        DateTime
  status            String   @default("issued")
  documents         Json?
  contractReference String?
  createdAt         DateTime @default(now())
  updatedAt         DateTime

  @@index([lcId])
  @@index([status])
}

model liquidity_forecasts {
  id              String   @id
  sovereignBankId String
  forecastDate    DateTime
  forecastType    String
  lcr             Decimal? @db.Decimal(32, 8)
  nsfr            Decimal? @db.Decimal(32, 8)
  hqla            Decimal? @db.Decimal(32, 8)
  forecastData    Json
  createdAt       DateTime @default(now())

  @@index([forecastDate])
  @@index([sovereignBankId])
}

model liquidity_gaps {
  id                    String                 @id
  gapId                 String                 @unique
  projectionId          String
  gapAmount             Decimal                @db.Decimal(32, 12)
  status                String                 @default("detected")
  createdAt             DateTime               @default(now())
  updatedAt             DateTime
  liquidity_projections liquidity_projections  @relation(fields: [projectionId], references: [id], onDelete: Cascade)
  singularity_liquidity singularity_liquidity?

  @@index([gapId])
  @@index([projectionId])
  @@index([status])
}

model liquidity_operations {
  id                          String                      @id
  operationId                 String                      @unique
  engineId                    String
  operationType               String
  amount                      Decimal                     @db.Decimal(32, 8)
  sourceAsset                 String?
  targetAsset                 String?
  status                      String                      @default("pending")
  executedAt                  DateTime?
  createdAt                   DateTime                    @default(now())
  updatedAt                   DateTime
  synthetic_liquidity_engines synthetic_liquidity_engines @relation(fields: [engineId], references: [id], onDelete: Cascade)

  @@index([engineId])
  @@index([operationId])
  @@index([operationType])
  @@index([status])
}

model liquidity_pools {
  id                 String          @id
  sovereignBankId    String
  currencyCode       String
  totalLiquidity     Decimal         @db.Decimal(32, 8)
  availableLiquidity Decimal         @db.Decimal(32, 8)
  reservedLiquidity  Decimal         @db.Decimal(32, 8)
  updatedAt          DateTime
  sovereign_banks    sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@unique([sovereignBankId, currencyCode])
  @@index([sovereignBankId])
}

model liquidity_projections {
  id                           String           @id
  projectionId                 String           @unique
  qpuPrediction                Decimal          @db.Decimal(32, 12)
  multiversalReserveStrength   Decimal          @db.Decimal(32, 12)
  consciousnessAlignmentFactor Decimal          @db.Decimal(32, 12)
  futureLiquidity              Decimal          @db.Decimal(32, 12)
  currentLiquidity             Decimal          @db.Decimal(32, 12)
  liquidityGap                 Decimal          @db.Decimal(32, 12)
  timeHorizon                  Int
  sufficiency                  Boolean          @default(false)
  status                       String           @default("calculated")
  createdAt                    DateTime         @default(now())
  updatedAt                    DateTime
  liquidity_gaps               liquidity_gaps[]

  @@index([projectionId])
  @@index([status])
  @@index([sufficiency])
}

model liquidity_scores {
  id              String   @id
  scoreId         String   @unique
  sovereignBankId String
  score           Decimal  @db.Decimal(32, 8)
  bufferLevel     Decimal? @db.Decimal(32, 8)
  riskFactors     Json?
  calculatedAt    DateTime @default(now())
  createdAt       DateTime @default(now())
  updatedAt       DateTime

  @@index([calculatedAt])
  @@index([scoreId])
  @@index([score])
  @@index([sovereignBankId])
}

model liquidity_stress_events {
  id                      String   @id
  eventId                 String   @unique
  sovereignBankId         String
  predictedAt             DateTime @default(now())
  predictedStressDate     DateTime
  stressLevel             String
  predictedLiquidityRatio Decimal  @db.Decimal(5, 2)
  confidence              Decimal  @db.Decimal(5, 4)
  status                  String   @default("PREDICTED")
  createdAt               DateTime @default(now())
  updatedAt               DateTime

  @@index([eventId])
  @@index([predictedStressDate])
  @@index([sovereignBankId])
  @@index([status])
}

model liquidity_tensors {
  id                          String                      @id
  tensorId                    String                      @unique
  engineId                    String
  commodityIndex              Int
  fxIndex                     Int
  temporalIndex               Int
  liquidityValue              Decimal                     @db.Decimal(32, 8)
  metadata                    Json?
  timestamp                   DateTime                    @default(now())
  createdAt                   DateTime                    @default(now())
  updatedAt                   DateTime
  synthetic_liquidity_engines synthetic_liquidity_engines @relation(fields: [engineId], references: [id], onDelete: Cascade)

  @@index([commodityIndex, fxIndex, temporalIndex])
  @@index([engineId])
  @@index([tensorId])
  @@index([timestamp])
}

model matrix_dimensions {
  id                      String                  @id
  dimensionId             String                  @unique
  matrixId                String
  dimensionType           String
  dimensionName           String
  dimensionData           Json
  status                  String                  @default("active")
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  omni_sovereign_matrices omni_sovereign_matrices @relation(fields: [matrixId], references: [id], onDelete: Cascade)

  @@index([dimensionId])
  @@index([dimensionType])
  @@index([matrixId])
}

model meta_sovereign_council_members {
  id                      String                  @id
  councilId               String
  sovereignBankId         String?
  memberName              String
  memberRole              String
  votingWeight            Decimal?                @db.Decimal(32, 8)
  status                  String                  @default("active")
  appointedAt             DateTime                @default(now())
  termEndDate             DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  meta_sovereign_councils meta_sovereign_councils @relation(fields: [councilId], references: [id], onDelete: Cascade)
  sovereign_banks         sovereign_banks?        @relation(fields: [sovereignBankId], references: [id])

  @@index([councilId])
  @@index([sovereignBankId])
}

model meta_sovereign_councils {
  id                             String                           @id
  councilId                      String                           @unique
  councilType                    String
  name                           String
  description                    String
  authorityLevel                 String
  status                         String                           @default("active")
  createdAt                      DateTime                         @default(now())
  updatedAt                      DateTime
  meta_sovereign_council_members meta_sovereign_council_members[]
  meta_sovereign_decisions       meta_sovereign_decisions[]
  meta_sovereign_policies        meta_sovereign_policies[]

  @@index([councilId])
  @@index([councilType])
  @@index([status])
}

model meta_sovereign_decisions {
  id                      String                  @id
  decisionId              String                  @unique
  councilId               String
  decisionType            String
  decisionContent         Json
  status                  String                  @default("pending")
  approvedAt              DateTime?
  executedAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  meta_sovereign_councils meta_sovereign_councils @relation(fields: [councilId], references: [id], onDelete: Cascade)

  @@index([councilId])
  @@index([decisionId])
  @@index([status])
}

model meta_sovereign_policies {
  id                      String                  @id
  policyId                String                  @unique
  councilId               String
  policyType              String
  policyTitle             String
  policyContent           Json
  enforcementLevel        String
  status                  String                  @default("draft")
  effectiveDate           DateTime?
  revokedAt               DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  meta_sovereign_councils meta_sovereign_councils @relation(fields: [councilId], references: [id], onDelete: Cascade)
  policy_enforcements     policy_enforcements[]

  @@index([councilId])
  @@index([policyId])
  @@index([policyType])
  @@index([status])
}

model metaverse_assets {
  id                   String          @id
  assetId              String          @unique
  metaverseNodeId      String
  assetType            String
  assetName            String
  tokenId              String?
  ownerAvatarId        String?
  value                Decimal?        @db.Decimal(32, 8)
  currencyCode         String?
  tokenClass           String?
  businessLicenseId    String?
  eventRights          Json?
  dataOwnershipTokenId String?
  aiCompanionId        String?
  status               String          @default("active")
  createdAt            DateTime        @default(now())
  updatedAt            DateTime
  metaverse_nodes      metaverse_nodes @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)

  @@index([assetId])
  @@index([assetType])
  @@index([metaverseNodeId])
  @@index([tokenId])
}

model metaverse_bridges {
  id              String          @id
  bridgeId        String          @unique
  metaverseNodeId String
  bridgeType      String
  virtualAssetId  String
  physicalAssetId String?
  nftTokenId      String?
  amount          Decimal         @db.Decimal(32, 8)
  currencyCode    String
  status          String          @default("active")
  createdAt       DateTime        @default(now())
  updatedAt       DateTime
  metaverse_nodes metaverse_nodes @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)

  @@index([bridgeId])
  @@index([bridgeType])
  @@index([metaverseNodeId])
  @@index([nftTokenId])
  @@index([virtualAssetId])
}

model metaverse_compute_nodes {
  id                          String           @id
  nodeId                      String           @unique
  nodeType                    String
  regionId                    String
  metaverseNodeId             String?
  latency                     Int
  gpuCapacity                 Int
  networkAddress              String
  sixGEnabled                 Boolean          @default(false)
  zkVerificationEnabled       Boolean          @default(false)
  holographicRenderingEnabled Boolean          @default(false)
  status                      String           @default("active")
  metadata                    Json?
  createdAt                   DateTime         @default(now())
  updatedAt                   DateTime
  metaverse_nodes             metaverse_nodes? @relation(fields: [metaverseNodeId], references: [id])

  @@index([metaverseNodeId])
  @@index([nodeId])
  @@index([nodeType])
  @@index([regionId])
  @@index([status])
}

model metaverse_consistency_checks {
  id                               String                           @id
  checkId                          String                           @unique
  dsezId                           String
  mdxState                         Json?
  primeState                       Json?
  parallelState                    Json?
  mergedState                      Json?
  consistencyStatus                String                           @default("pending")
  identityCoherence                Boolean                          @default(false)
  assetRealityMapping              Boolean                          @default(false)
  omegaValidation                  Boolean                          @default(false)
  checkedAt                        DateTime?
  createdAt                        DateTime                         @default(now())
  updatedAt                        DateTime
  digital_sovereign_economic_zones digital_sovereign_economic_zones @relation(fields: [dsezId], references: [id], onDelete: Cascade)

  @@index([checkId])
  @@index([checkedAt])
  @@index([consistencyStatus])
  @@index([dsezId])
}

model metaverse_fx_transactions {
  id                                                                               String          @id
  fxTransactionId                                                                  String          @unique
  sourceMetaverseNodeId                                                            String
  targetMetaverseNodeId                                                            String
  sourceAmount                                                                     Decimal         @db.Decimal(32, 8)
  targetAmount                                                                     Decimal         @db.Decimal(32, 8)
  sourceCurrency                                                                   String
  targetCurrency                                                                   String
  exchangeRate                                                                     Decimal         @db.Decimal(32, 12)
  conversionMethod                                                                 String
  realityType                                                                      String?
  status                                                                           String          @default("completed")
  createdAt                                                                        DateTime        @default(now())
  updatedAt                                                                        DateTime
  metaverse_nodes_metaverse_fx_transactions_sourceMetaverseNodeIdTometaverse_nodes metaverse_nodes @relation("metaverse_fx_transactions_sourceMetaverseNodeIdTometaverse_nodes", fields: [sourceMetaverseNodeId], references: [id], onDelete: Cascade)
  metaverse_nodes_metaverse_fx_transactions_targetMetaverseNodeIdTometaverse_nodes metaverse_nodes @relation("metaverse_fx_transactions_targetMetaverseNodeIdTometaverse_nodes", fields: [targetMetaverseNodeId], references: [id], onDelete: Cascade)

  @@index([fxTransactionId])
  @@index([sourceMetaverseNodeId])
  @@index([status])
  @@index([targetMetaverseNodeId])
}

model metaverse_identities {
  id              String          @id
  identityId      String          @unique
  metaverseNodeId String
  avatarId        String
  identityLayer   String
  sovereignBankId String?
  identityHash    String
  identityData    Json
  status          String          @default("active")
  createdAt       DateTime        @default(now())
  updatedAt       DateTime
  metaverse_nodes metaverse_nodes @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)

  @@index([avatarId])
  @@index([identityId])
  @@index([identityLayer])
  @@index([metaverseNodeId])
}

model metaverse_nodes {
  id                                                                                         String                             @id
  nodeId                                                                                     String                             @unique
  metaverseName                                                                              String
  metaverseType                                                                              String
  settlementEndpoint                                                                         String
  cbdcOnRampEnabled                                                                          Boolean                            @default(false)
  cbdcOffRampEnabled                                                                         Boolean                            @default(false)
  gruOnRampEnabled                                                                           Boolean                            @default(false)
  gruOffRampEnabled                                                                          Boolean                            @default(false)
  identityLayer                                                                              String
  assetTokenizationEnabled                                                                   Boolean                            @default(false)
  status                                                                                     String                             @default("active")
  createdAt                                                                                  DateTime                           @default(now())
  updatedAt                                                                                  DateTime
  digital_sovereign_economic_zones                                                           digital_sovereign_economic_zones[]
  metaverse_assets                                                                           metaverse_assets[]
  metaverse_bridges                                                                          metaverse_bridges[]
  metaverse_compute_nodes                                                                    metaverse_compute_nodes[]
  metaverse_fx_transactions_metaverse_fx_transactions_sourceMetaverseNodeIdTometaverse_nodes metaverse_fx_transactions[]        @relation("metaverse_fx_transactions_sourceMetaverseNodeIdTometaverse_nodes")
  metaverse_fx_transactions_metaverse_fx_transactions_targetMetaverseNodeIdTometaverse_nodes metaverse_fx_transactions[]        @relation("metaverse_fx_transactions_targetMetaverseNodeIdTometaverse_nodes")
  metaverse_identities                                                                       metaverse_identities[]
  metaverse_ramp_transactions                                                                metaverse_ramp_transactions[]
  metaverse_settlements                                                                      metaverse_settlements[]

  @@index([metaverseName])
  @@index([nodeId])
  @@index([status])
}

model metaverse_ramp_transactions {
  id                               String                           @id
  rampId                           String                           @unique
  dsezId                           String
  rampType                         String
  sourceType                       String
  targetType                       String
  amount                           Decimal                          @db.Decimal(32, 8)
  currencyCode                     String
  metaverseNodeId                  String
  sourceBankId                     String?
  destinationBankId                String?
  exchangeRate                     Decimal?                         @db.Decimal(32, 12)
  status                           String                           @default("pending")
  validationHash                   String?
  complianceCheck                  Boolean                          @default(false)
  processedAt                      DateTime?
  createdAt                        DateTime                         @default(now())
  updatedAt                        DateTime
  digital_sovereign_economic_zones digital_sovereign_economic_zones @relation(fields: [dsezId], references: [id], onDelete: Cascade)
  metaverse_nodes                  metaverse_nodes                  @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)

  @@index([createdAt])
  @@index([dsezId])
  @@index([metaverseNodeId])
  @@index([rampId])
  @@index([rampType])
  @@index([status])
}

model metaverse_settlements {
  id                String          @id
  settlementId      String          @unique
  metaverseNodeId   String
  gasSettlementId   String
  sourceBankId      String
  destinationBankId String
  virtualLandId     String
  amount            Decimal         @db.Decimal(32, 8)
  currencyCode      String
  assetType         String
  status            String          @default("pending")
  settledAt         DateTime?
  createdAt         DateTime        @default(now())
  updatedAt         DateTime
  metaverse_nodes   metaverse_nodes @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)

  @@index([metaverseNodeId])
  @@index([settlementId])
  @@index([status])
  @@index([virtualLandId])
}

model metaverse_token_classes {
  id           String   @id
  tokenClassId String   @unique
  tokenClass   String   @unique
  className    String
  description  String
  metadata     Json?
  status       String   @default("active")
  createdAt    DateTime @default(now())
  updatedAt    DateTime

  @@index([tokenClassId])
  @@index([tokenClass])
}

model migration_audits {
  id                       String                   @id
  phaseId                  String
  componentType            String
  componentId              String
  migrationStatus          String
  oldKeyId                 String?
  newKeyId                 String?
  migrationDate            DateTime?
  notes                    String?
  createdAt                DateTime                 @default(now())
  updatedAt                DateTime
  quantum_migration_phases quantum_migration_phases @relation(fields: [phaseId], references: [id], onDelete: Cascade)

  @@index([componentId])
  @@index([componentType])
  @@index([migrationStatus])
  @@index([phaseId])
}

model monetary_drift_corrections {
  id               String    @id
  correctionId     String    @unique
  currencyCode     String
  assetType        String
  driftAmount      Decimal   @db.Decimal(32, 12)
  driftType        String
  correctionMethod String
  correctionAmount Decimal   @db.Decimal(32, 12)
  status           String    @default("pending")
  appliedAt        DateTime?
  createdAt        DateTime  @default(now())
  updatedAt        DateTime

  @@index([assetType])
  @@index([correctionId])
  @@index([currencyCode])
  @@index([status])
}

model monetary_unit_conversions {
  id                                                                                            String                     @id
  conversionId                                                                                  String                     @unique
  sourceUnitId                                                                                  String
  targetUnitId                                                                                  String
  conversionRate                                                                                Decimal                    @db.Decimal(32, 12)
  conversionFormula                                                                             Json?
  confidenceLevel                                                                               Decimal                    @db.Decimal(32, 12)
  status                                                                                        String                     @default("active")
  validFrom                                                                                     DateTime                   @default(now())
  validTo                                                                                       DateTime?
  createdAt                                                                                     DateTime                   @default(now())
  updatedAt                                                                                     DateTime
  multiversal_monetary_units_monetary_unit_conversions_sourceUnitIdTomultiversal_monetary_units multiversal_monetary_units @relation("monetary_unit_conversions_sourceUnitIdTomultiversal_monetary_units", fields: [sourceUnitId], references: [id], onDelete: Cascade)
  multiversal_monetary_units_monetary_unit_conversions_targetUnitIdTomultiversal_monetary_units multiversal_monetary_units @relation("monetary_unit_conversions_targetUnitIdTomultiversal_monetary_units", fields: [targetUnitId], references: [id], onDelete: Cascade)
  reality_layers                                                                                reality_layers[]           @relation("MonetaryUnitConversionToRealityLayer")

  @@index([conversionId])
  @@index([sourceUnitId])
  @@index([status])
  @@index([targetUnitId])
}

model mrli_synchronizations {
  id                    String                @id
  syncId                String                @unique
  ledgerId              String
  classicalState        Json?
  dltState              Json?
  quantumState          Json?
  simulatedState        Json?
  mergedState           Json
  conflictDetected      Boolean               @default(false)
  conflictResolution    Json?
  resolutionMethod      String?
  status                String                @default("pending")
  syncedAt              DateTime?
  resolvedAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  multi_reality_ledgers multi_reality_ledgers @relation(fields: [ledgerId], references: [id], onDelete: Cascade)

  @@index([ledgerId])
  @@index([status])
  @@index([syncId])
}

model mrtgs_queues {
  id                String             @id
  queueId           String             @unique
  paymentId         String
  priorityTier      Int
  priorityScore     Decimal            @db.Decimal(32, 12)
  assetType         String
  amount            Decimal            @db.Decimal(32, 8)
  currencyCode      String
  sourceBankId      String
  destinationBankId String
  queuePosition     Int
  status            String             @default("queued")
  queuedAt          DateTime           @default(now())
  processedAt       DateTime?
  createdAt         DateTime           @default(now())
  updatedAt         DateTime
  mrtgs_settlements mrtgs_settlements?

  @@index([paymentId])
  @@index([priorityScore])
  @@index([priorityTier])
  @@index([queueId])
  @@index([queuedAt])
  @@index([status])
}

model mrtgs_risk_alerts {
  id                String            @id
  alertId           String            @unique
  settlementId      String
  alertType         String
  severity          String
  description       String
  metrics           Json
  status            String            @default("active")
  createdAt         DateTime          @default(now())
  resolvedAt        DateTime?
  updatedAt         DateTime
  mrtgs_settlements mrtgs_settlements @relation(fields: [settlementId], references: [id], onDelete: Cascade)

  @@index([alertId])
  @@index([alertType])
  @@index([settlementId])
  @@index([severity])
  @@index([status])
}

model mrtgs_settlements {
  id                String              @id
  settlementId      String              @unique
  queueId           String              @unique
  paymentId         String
  assetType         String
  amount            Decimal             @db.Decimal(32, 8)
  currencyCode      String
  sourceBankId      String
  destinationBankId String
  settlementTime    Int
  ledgerSyncStatus  Json
  status            String              @default("pending")
  settledAt         DateTime?
  createdAt         DateTime            @default(now())
  updatedAt         DateTime
  mrtgs_risk_alerts mrtgs_risk_alerts[]
  mrtgs_queues      mrtgs_queues        @relation(fields: [queueId], references: [id], onDelete: Cascade)

  @@index([paymentId])
  @@index([queueId])
  @@index([settlementId])
  @@index([status])
}

model multi_asset_collaterals {
  id                       String                     @id
  collateralId             String                     @unique
  assetType                String
  assetId                  String?
  amount                   Decimal                    @db.Decimal(32, 8)
  valuation                Decimal                    @db.Decimal(32, 12)
  haircut                  Decimal?                   @db.Decimal(32, 12)
  fxCost                   Decimal?                   @db.Decimal(32, 12)
  liquidityWeight          Decimal?                   @db.Decimal(32, 12)
  sriRiskPenalty           Decimal?                   @db.Decimal(32, 12)
  optimizationScore        Decimal?                   @db.Decimal(32, 12)
  status                   String                     @default("active")
  allocatedAt              DateTime                   @default(now())
  releasedAt               DateTime?
  createdAt                DateTime                   @default(now())
  updatedAt                DateTime
  collateral_optimizations collateral_optimizations[]

  @@index([assetType])
  @@index([collateralId])
  @@index([status])
}

model multi_asset_contagion_risks {
  id                String            @id
  riskId            String            @unique
  simulationId      String
  sourceAsset       String
  targetAsset       String
  contagionScore    Decimal           @db.Decimal(32, 12)
  riskFactors       Json?
  severity          String
  assessedAt        DateTime          @default(now())
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  afcss_simulations afcss_simulations @relation(fields: [simulationId], references: [id], onDelete: Cascade)

  @@index([riskId])
  @@index([severity])
  @@index([simulationId])
  @@index([sourceAsset, targetAsset])
}

model multi_reality_ledgers {
  id                            String                          @id
  ledgerId                      String                          @unique
  ledgerName                    String
  ledgerType                    String
  mergedState                   Json?
  status                        String                          @default("active")
  lastSyncAt                    DateTime?
  createdAt                     DateTime                        @default(now())
  updatedAt                     DateTime
  classical_interfaces          classical_interfaces[]
  distributed_ledger_interfaces distributed_ledger_interfaces[]
  mrli_synchronizations         mrli_synchronizations[]
  quantum_ledger_interfaces     quantum_ledger_interfaces[]
  simulation_interfaces         simulation_interfaces[]

  @@index([ledgerId])
  @@index([ledgerType])
  @@index([status])
}

model multiversal_monetary_units {
  id                                                                                           String                      @id
  unitId                                                                                       String                      @unique
  layerId                                                                                      String
  unitType                                                                                     String
  unitName                                                                                     String
  anchorValue                                                                                  Decimal?                    @db.Decimal(32, 12)
  derivationFormula                                                                            Json?
  quantumState                                                                                 Json?
  holographicEncoding                                                                          Json?
  status                                                                                       String                      @default("active")
  createdAt                                                                                    DateTime                    @default(now())
  updatedAt                                                                                    DateTime
  monetary_unit_conversions_monetary_unit_conversions_sourceUnitIdTomultiversal_monetary_units monetary_unit_conversions[] @relation("monetary_unit_conversions_sourceUnitIdTomultiversal_monetary_units")
  monetary_unit_conversions_monetary_unit_conversions_targetUnitIdTomultiversal_monetary_units monetary_unit_conversions[] @relation("monetary_unit_conversions_targetUnitIdTomultiversal_monetary_units")
  reality_layers                                                                               reality_layers              @relation(fields: [layerId], references: [id], onDelete: Cascade)
  valuation_calculations                                                                       valuation_calculations[]

  @@index([layerId])
  @@index([unitId])
  @@index([unitType])
}

model multiverse_stability_indices {
  id                     String                   @id
  indexId                String                   @unique
  realityLayer           String
  fxStability            Decimal                  @db.Decimal(32, 12)
  ssuInertia             Decimal                  @db.Decimal(32, 12)
  temporalSmoothing      Decimal                  @db.Decimal(32, 12)
  crossRealityDivergence Decimal                  @db.Decimal(32, 12)
  totalStability         Decimal                  @db.Decimal(32, 12)
  status                 String                   @default("active")
  calculatedAt           DateTime                 @default(now())
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  reality_divergences    reality_divergences[]
  stability_calculations stability_calculations[]

  @@index([calculatedAt])
  @@index([indexId])
  @@index([realityLayer])
}

model multiverse_state_mappings {
  id                              String                          @id
  mappingId                       String                          @unique
  continuityId                    String
  realityType                     String
  stateIdentifier                 String
  stateData                       Json?
  divergence                      Decimal?                        @db.Decimal(32, 12)
  lastSynced                      DateTime?
  status                          String                          @default("active")
  createdAt                       DateTime                        @default(now())
  updatedAt                       DateTime
  sovereign_continuity_identities sovereign_continuity_identities @relation(fields: [continuityId], references: [id], onDelete: Cascade)

  @@index([continuityId])
  @@index([mappingId])
  @@index([realityType])
  @@index([status])
}

model neural_consensus_states {
  id                        String                      @id
  stateId                   String                      @unique
  ledgerStateHash           String
  neuralVote                Decimal                     @db.Decimal(32, 12)
  scbSignals                Json
  aiForecasts               Json
  quantumSignatures         Json
  consensusResult           String
  confidenceThreshold       Decimal                     @default(97) @db.Decimal(32, 12)
  status                    String                      @default("pending")
  confirmedAt               DateTime?
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime
  neural_layers             neural_layers[]
  neural_quantum_signatures neural_quantum_signatures[]

  @@index([consensusResult])
  @@index([ledgerStateHash])
  @@index([stateId])
  @@index([status])
}

model neural_layers {
  id                      String                  @id
  layerId                 String                  @unique
  stateId                 String
  layerType               String
  layerData               Json
  output                  Json?
  status                  String                  @default("active")
  processedAt             DateTime                @default(now())
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  neural_consensus_states neural_consensus_states @relation(fields: [stateId], references: [id], onDelete: Cascade)

  @@index([layerId])
  @@index([layerType])
  @@index([stateId])
}

model neural_quantum_signatures {
  id                      String                  @id
  signatureId             String                  @unique
  stateId                 String
  quantumKeyId            String
  signature               String
  signatureType           String
  thresholdMet            Boolean                 @default(false)
  verifiedAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  neural_consensus_states neural_consensus_states @relation(fields: [stateId], references: [id], onDelete: Cascade)

  @@index([quantumKeyId])
  @@index([signatureId])
  @@index([stateId])
  @@index([thresholdMet])
}

model node_quarantines {
  id               String    @id
  quarantineId     String    @unique
  nodeId           String
  sovereignBankId  String?
  quarantineReason String
  quarantineType   String
  status           String    @default("quarantined")
  quarantinedAt    DateTime  @default(now())
  releasedAt       DateTime?
  metadata         Json?
  createdAt        DateTime  @default(now())
  updatedAt        DateTime

  @@index([nodeId])
  @@index([quarantineId])
  @@index([sovereignBankId])
  @@index([status])
}

model nostro_vostro_accounts {
  id                                                                                    String                          @id
  accountId                                                                             String                          @unique
  ownerParticipantId                                                                    String
  counterpartyParticipantId                                                             String
  ibanOrLocalAccount                                                                    String?
  currency                                                                              String
  accountType                                                                           String
  status                                                                                String                          @default("ACTIVE")
  currentBalance                                                                        Decimal                         @default(0) @db.Decimal(32, 8)
  availableLiquidity                                                                    Decimal                         @default(0) @db.Decimal(32, 8)
  holdAmount                                                                            Decimal                         @default(0) @db.Decimal(32, 8)
  lastUpdatedAt                                                                         DateTime                        @default(now())
  metadata                                                                              Json?
  createdAt                                                                             DateTime                        @default(now())
  updatedAt                                                                             DateTime
  nostro_vostro_participants                                                            nostro_vostro_participants      @relation(fields: [ownerParticipantId], references: [id], onDelete: Cascade)
  nostro_vostro_balance_history                                                         nostro_vostro_balance_history[]
  nostro_vostro_transfers_nostro_vostro_transfers_fromAccountIdTonostro_vostro_accounts nostro_vostro_transfers[]       @relation("nostro_vostro_transfers_fromAccountIdTonostro_vostro_accounts")
  nostro_vostro_transfers_nostro_vostro_transfers_toAccountIdTonostro_vostro_accounts   nostro_vostro_transfers[]       @relation("nostro_vostro_transfers_toAccountIdTonostro_vostro_accounts")

  @@index([accountId])
  @@index([accountType])
  @@index([counterpartyParticipantId])
  @@index([currency])
  @@index([ownerParticipantId])
  @@index([status])
}

model nostro_vostro_balance_history {
  id                     String                 @id
  accountId              String
  balance                Decimal                @db.Decimal(32, 8)
  availableLiquidity     Decimal                @db.Decimal(32, 8)
  holdAmount             Decimal                @db.Decimal(32, 8)
  recordedAt             DateTime               @default(now())
  nostro_vostro_accounts nostro_vostro_accounts @relation(fields: [accountId], references: [id], onDelete: Cascade)

  @@index([accountId])
  @@index([recordedAt])
}

model nostro_vostro_participants {
  id                                                                                            String                                @id
  participantId                                                                                 String                                @unique
  name                                                                                          String
  bic                                                                                           String?                               @unique
  lei                                                                                           String?                               @unique
  country                                                                                       String
  regulatoryTier                                                                                String
  sovereignBankId                                                                               String?
  status                                                                                        String                                @default("active")
  metadata                                                                                      Json?
  createdAt                                                                                     DateTime                              @default(now())
  updatedAt                                                                                     DateTime
  nostro_vostro_accounts                                                                        nostro_vostro_accounts[]
  sovereign_banks                                                                               sovereign_banks?                      @relation(fields: [sovereignBankId], references: [id])
  nostro_vostro_reconciliations                                                                 nostro_vostro_reconciliations[]
  nostro_vostro_transfers_nostro_vostro_transfers_fromParticipantIdTonostro_vostro_participants nostro_vostro_transfers[]             @relation("nostro_vostro_transfers_fromParticipantIdTonostro_vostro_participants")
  nostro_vostro_transfers_nostro_vostro_transfers_toParticipantIdTonostro_vostro_participants   nostro_vostro_transfers[]             @relation("nostro_vostro_transfers_toParticipantIdTonostro_vostro_participants")
  nostro_vostro_webhook_subscriptions                                                           nostro_vostro_webhook_subscriptions[]

  @@index([bic])
  @@index([country])
  @@index([lei])
  @@index([participantId])
  @@index([regulatoryTier])
  @@index([status])
}

model nostro_vostro_reconciliation_transfers {
  id                            String                        @id
  reconciliationId              String                        @unique
  transferId                    String                        @unique
  matched                       Boolean                       @default(false)
  matchDetails                  Json?
  createdAt                     DateTime                      @default(now())
  nostro_vostro_reconciliations nostro_vostro_reconciliations @relation(fields: [reconciliationId], references: [id], onDelete: Cascade)
  nostro_vostro_transfers       nostro_vostro_transfers       @relation(fields: [transferId], references: [id], onDelete: Cascade)

  @@index([reconciliationId])
  @@index([transferId])
}

model nostro_vostro_reconciliations {
  id                                     String                                  @id
  reportId                               String                                  @unique
  participantId                          String
  asOfDate                               DateTime
  openingBalance                         Decimal                                 @db.Decimal(32, 8)
  closingBalance                         Decimal                                 @db.Decimal(32, 8)
  totalDebits                            Decimal                                 @default(0) @db.Decimal(32, 8)
  totalCredits                           Decimal                                 @default(0) @db.Decimal(32, 8)
  breakCount                             Int                                     @default(0)
  status                                 String                                  @default("PENDING")
  breaks                                 Json?
  metadata                               Json?
  completedAt                            DateTime?
  createdAt                              DateTime                                @default(now())
  updatedAt                              DateTime
  nostro_vostro_reconciliation_transfers nostro_vostro_reconciliation_transfers?
  nostro_vostro_participants             nostro_vostro_participants              @relation(fields: [participantId], references: [id], onDelete: Cascade)

  @@index([asOfDate])
  @@index([participantId])
  @@index([reportId])
  @@index([status])
}

model nostro_vostro_transfers {
  id                                                                                               String                                  @id
  transferId                                                                                       String                                  @unique
  fromAccountId                                                                                    String
  toAccountId                                                                                      String
  fromParticipantId                                                                                String
  toParticipantId                                                                                  String
  amount                                                                                           Decimal                                 @db.Decimal(32, 8)
  currency                                                                                         String
  settlementAsset                                                                                  String                                  @default("FIAT")
  valueDate                                                                                        DateTime
  fxDetails                                                                                        Json?
  status                                                                                           String                                  @default("PENDING")
  rejectionReason                                                                                  String?
  idempotencyKey                                                                                   String?                                 @unique
  reference                                                                                        String?
  metadata                                                                                         Json?
  settledAt                                                                                        DateTime?
  createdAt                                                                                        DateTime                                @default(now())
  updatedAt                                                                                        DateTime
  nostro_vostro_reconciliation_transfers                                                           nostro_vostro_reconciliation_transfers?
  nostro_vostro_accounts_nostro_vostro_transfers_fromAccountIdTonostro_vostro_accounts             nostro_vostro_accounts                  @relation("nostro_vostro_transfers_fromAccountIdTonostro_vostro_accounts", fields: [fromAccountId], references: [id])
  nostro_vostro_participants_nostro_vostro_transfers_fromParticipantIdTonostro_vostro_participants nostro_vostro_participants              @relation("nostro_vostro_transfers_fromParticipantIdTonostro_vostro_participants", fields: [fromParticipantId], references: [id])
  nostro_vostro_accounts_nostro_vostro_transfers_toAccountIdTonostro_vostro_accounts               nostro_vostro_accounts                  @relation("nostro_vostro_transfers_toAccountIdTonostro_vostro_accounts", fields: [toAccountId], references: [id])
  nostro_vostro_participants_nostro_vostro_transfers_toParticipantIdTonostro_vostro_participants   nostro_vostro_participants              @relation("nostro_vostro_transfers_toParticipantIdTonostro_vostro_participants", fields: [toParticipantId], references: [id])

  @@index([fromAccountId])
  @@index([fromParticipantId])
  @@index([idempotencyKey])
  @@index([settlementAsset])
  @@index([status])
  @@index([toAccountId])
  @@index([toParticipantId])
  @@index([transferId])
  @@index([valueDate])
}

model nostro_vostro_webhook_events {
  id                                  String                              @id
  eventId                             String                              @unique
  subscriptionId                      String
  eventType                           String
  payload                             Json
  status                              String                              @default("PENDING")
  deliveryAttempts                    Int                                 @default(0)
  lastAttemptAt                       DateTime?
  deliveredAt                         DateTime?
  errorMessage                        String?
  createdAt                           DateTime                            @default(now())
  updatedAt                           DateTime
  nostro_vostro_webhook_subscriptions nostro_vostro_webhook_subscriptions @relation(fields: [subscriptionId], references: [id], onDelete: Cascade)

  @@index([createdAt])
  @@index([eventId])
  @@index([eventType])
  @@index([status])
  @@index([subscriptionId])
}

model nostro_vostro_webhook_subscriptions {
  id                           String                         @id
  subscriptionId               String                         @unique
  participantId                String
  webhookUrl                   String
  eventTypes                   String[]
  secret                       String
  status                       String                         @default("ACTIVE")
  lastDeliveryAt               DateTime?
  failureCount                 Int                            @default(0)
  metadata                     Json?
  createdAt                    DateTime                       @default(now())
  updatedAt                    DateTime
  nostro_vostro_webhook_events nostro_vostro_webhook_events[]
  nostro_vostro_participants   nostro_vostro_participants     @relation(fields: [participantId], references: [id], onDelete: Cascade)

  @@index([participantId])
  @@index([status])
  @@index([subscriptionId])
}

model omega_consistency_events {
  id                    String                @id
  eventId               String                @unique
  reconciliationId      String
  eventType             String
  eventData             Json?
  consistencyBefore     String?
  consistencyAfter      String?
  timestamp             DateTime              @default(now())
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  omega_reconciliations omega_reconciliations @relation(fields: [reconciliationId], references: [id], onDelete: Cascade)

  @@index([eventId])
  @@index([eventType])
  @@index([reconciliationId])
  @@index([timestamp])
}

model omega_layers {
  id                    String                  @id
  layerId               String                  @unique
  layerNumber           Int
  layerName             String
  description           String
  status                String                  @default("active")
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  omega_reconciliations omega_reconciliations[]
  omega_states          omega_states[]

  @@index([layerId])
  @@index([layerNumber])
  @@index([status])
}

model omega_reconciliations {
  id                       String                     @id
  reconciliationId         String                     @unique
  layerId                  String?
  reconciliationType       String
  primeState               Json?
  quantumState             Json?
  holographicState         Json?
  parallelState            Json?
  temporalState            Json?
  mergedState              Json
  inconsistencyDetected    Boolean                    @default(false)
  correctionMethod         String?
  correctionApplied        Json?
  status                   String                     @default("pending")
  reconciledAt             DateTime?
  createdAt                DateTime                   @default(now())
  updatedAt                DateTime
  omega_consistency_events omega_consistency_events[]
  omega_layers             omega_layers?              @relation(fields: [layerId], references: [id])

  @@index([layerId])
  @@index([reconciledAt])
  @@index([reconciliationId])
  @@index([status])
}

model omega_states {
  id                String       @id
  stateId           String       @unique
  layerId           String
  stateHash         String
  stateData         Json
  primeState        Json?
  quantumState      Json?
  holographicState  Json?
  parallelState     Json?
  temporalState     Json?
  mergedState       Json?
  consistencyStatus String       @default("pending")
  timestamp         DateTime     @default(now())
  createdAt         DateTime     @default(now())
  updatedAt         DateTime
  omega_layers      omega_layers @relation(fields: [layerId], references: [id], onDelete: Cascade)

  @@index([consistencyStatus])
  @@index([layerId])
  @@index([stateId])
  @@index([timestamp])
}

model omni_sovereign_matrices {
  id                     String                   @id
  matrixId               String                   @unique
  matrixName             String
  status                 String                   @default("active")
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  matrix_dimensions      matrix_dimensions[]
  reality_layer_states   reality_layer_states[]
  settlement_coordinates settlement_coordinates[]

  @@index([matrixId])
  @@index([status])
}

model ontology_mappings {
  id           String   @id
  sourceDomain String
  sourceId     String
  targetDomain String
  targetId     String
  mappingType  String
  confidence   Decimal  @db.Decimal(5, 4)
  metadata     Json?
  createdAt    DateTime @default(now())
  updatedAt    DateTime

  @@index([sourceDomain, sourceId])
  @@index([targetDomain, targetId])
}

model pan_reality_monetary_fabric {
  id                        String                    @id
  fabricId                  String                    @unique
  fabricVersion             String                    @default("1.0")
  ummcState                 Json?
  omegaLsfState             Json?
  hsmnState                 Json?
  tcmpState                 Json?
  ilieState                 Json?
  mergedState               Json?
  crossDimensionalAlignment Boolean                   @default(false)
  temporalIntegrity         Boolean                   @default(false)
  quantumCoherence          Boolean                   @default(false)
  holographicHarmony        Boolean                   @default(false)
  sovereignContinuity       Boolean                   @default(false)
  overallStatus             String                    @default("initializing")
  lastMergeAt               DateTime?
  createdAt                 DateTime                  @default(now())
  updatedAt                 DateTime
  fabric_alignments         fabric_alignments[]
  fabric_integrity_checks   fabric_integrity_checks[]

  @@index([fabricId])
  @@index([overallStatus])
}

model paradox_detections {
  id                         String                     @id
  detectionId                String                     @unique
  portalId                   String
  transactionId              String?
  paradoxType                String
  severity                   String
  detectedAt                 DateTime                   @default(now())
  resolved                   Boolean                    @default(false)
  resolutionMethod           String?
  resolvedAt                 DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  temporal_liquidity_portals temporal_liquidity_portals @relation(fields: [portalId], references: [id], onDelete: Cascade)

  @@index([detectionId])
  @@index([paradoxType])
  @@index([portalId])
  @@index([resolved])
  @@index([transactionId])
}

model parallel_reserve_branches {
  id                      String                  @id
  branchId                String                  @unique
  reserveId               String
  branchName              String
  branchState             String
  reserveAmount           Decimal                 @db.Decimal(32, 12)
  probability             Decimal?                @db.Decimal(32, 12)
  divergence              Decimal?                @db.Decimal(32, 12)
  status                  String                  @default("active")
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  infinite_state_reserves infinite_state_reserves @relation(fields: [reserveId], references: [id], onDelete: Cascade)

  @@index([branchId])
  @@index([branchState])
  @@index([reserveId])
  @@index([status])
}

model parity_divergences {
  id                 String             @id
  divergenceId       String             @unique
  parityId           String
  divergenceAmount   Decimal            @db.Decimal(32, 12)
  severity           String
  status             String             @default("detected")
  createdAt          DateTime           @default(now())
  updatedAt          DateTime
  temporal_fx_parity temporal_fx_parity @relation(fields: [parityId], references: [id], onDelete: Cascade)

  @@index([divergenceId])
  @@index([parityId])
  @@index([severity])
  @@index([status])
}

model pattern_alerts {
  id              String          @id
  patternMatchId  String
  transactionId   String
  patternCode     String
  severity        String
  description     String
  status          String          @default("PENDING")
  createdAt       DateTime        @default(now())
  updatedAt       DateTime
  pattern_matches pattern_matches @relation(fields: [patternMatchId], references: [id], onDelete: Cascade)

  @@index([createdAt])
  @@index([id])
  @@index([patternMatchId])
  @@index([status])
  @@index([transactionId])
}

model pattern_matches {
  id                String           @id
  patternId         String
  transactionId     String
  matchScore        Decimal          @db.Decimal(5, 4)
  matchedConditions String[]
  alertGenerated    Boolean          @default(false)
  detectedAt        DateTime         @default(now())
  pattern_alerts    pattern_alerts[]
  wapl_patterns     wapl_patterns    @relation(fields: [patternId], references: [id], onDelete: Cascade)

  @@index([detectedAt])
  @@index([id])
  @@index([patternId])
  @@index([transactionId])
}

model pep_graph_edges {
  id                                                          String          @id
  fromNodeId                                                  String
  toNodeId                                                    String
  relationshipType                                            String
  strength                                                    Decimal         @db.Decimal(5, 4)
  createdAt                                                   DateTime        @default(now())
  updatedAt                                                   DateTime
  pep_graph_nodes_pep_graph_edges_fromNodeIdTopep_graph_nodes pep_graph_nodes @relation("pep_graph_edges_fromNodeIdTopep_graph_nodes", fields: [fromNodeId], references: [entityId], onDelete: Cascade)
  pep_graph_nodes_pep_graph_edges_toNodeIdTopep_graph_nodes   pep_graph_nodes @relation("pep_graph_edges_toNodeIdTopep_graph_nodes", fields: [toNodeId], references: [entityId], onDelete: Cascade)

  @@index([fromNodeId])
  @@index([relationshipType])
  @@index([toNodeId])
}

model pep_graph_nodes {
  id                                                          String            @id
  entityId                                                    String            @unique
  entityName                                                  String
  pepType                                                     String
  country                                                     String
  position                                                    String
  riskLevel                                                   String
  createdAt                                                   DateTime          @default(now())
  updatedAt                                                   DateTime
  pep_graph_edges_pep_graph_edges_fromNodeIdTopep_graph_nodes pep_graph_edges[] @relation("pep_graph_edges_fromNodeIdTopep_graph_nodes")
  pep_graph_edges_pep_graph_edges_toNodeIdTopep_graph_nodes   pep_graph_edges[] @relation("pep_graph_edges_toNodeIdTopep_graph_nodes")

  @@index([country])
  @@index([entityId])
  @@index([entityName])
}

model policy_enforcements {
  id                      String                  @id
  enforcementId           String                  @unique
  policyId                String
  enforcementType         String
  targetSovereignBankId   String?
  enforcementData         Json
  status                  String                  @default("pending")
  executedAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  meta_sovereign_policies meta_sovereign_policies @relation(fields: [policyId], references: [id], onDelete: Cascade)

  @@index([enforcementId])
  @@index([policyId])
  @@index([status])
  @@index([targetSovereignBankId])
}

model pq_signature_blocks {
  id                 String     @id
  signatureId        String     @unique
  blockId            String
  algorithm          String
  signature          String
  publicKey          String
  verificationStatus String     @default("pending")
  verifiedAt         DateTime?
  createdAt          DateTime   @default(now())
  updatedAt          DateTime
  gql_blocks         gql_blocks @relation(fields: [blockId], references: [id], onDelete: Cascade)

  @@index([algorithm])
  @@index([blockId])
  @@index([signatureId])
  @@index([verificationStatus])
}

model prime_reality_deviations {
  id                     String                   @id
  deviationId            String                   @unique
  realityType            String
  realityId              String
  primeRealityState      Decimal                  @db.Decimal(32, 12)
  alternateRealityState  Decimal                  @db.Decimal(32, 12)
  deviationAmount        Decimal                  @db.Decimal(32, 12)
  threshold              Decimal                  @db.Decimal(32, 12)
  exceedsThreshold       Boolean                  @default(false)
  requiresAlignment      Boolean                  @default(false)
  status                 String                   @default("detected")
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  alignment_enforcements alignment_enforcements[]

  @@index([deviationId])
  @@index([realityId])
  @@index([realityType])
  @@index([requiresAlignment])
  @@index([status])
}

model psg_master_grids {
  id                         String                       @id
  gridId                     String                       @unique
  gridName                   String                       @default("DBIS Master Grid")
  consensusEngine            String
  status                     String                       @default("active")
  lastConsensusAt            DateTime?
  createdAt                  DateTime                     @default(now())
  updatedAt                  DateTime
  settlement_epochs          settlement_epochs[]
  supra_sovereign_relay_hubs supra_sovereign_relay_hubs[]

  @@index([gridId])
  @@index([status])
}

model psg_sovereign_nodes {
  id                String              @id
  nodeId            String              @unique
  sovereignBankId   String
  region            String
  nodeType          String
  replicationLinks  Json?
  status            String              @default("active")
  lastSyncAt        DateTime?
  metadata          Json?
  createdAt         DateTime            @default(now())
  updatedAt         DateTime
  psg_state_blocks  psg_state_blocks[]
  settlement_epochs settlement_epochs[]

  @@index([nodeId])
  @@index([region])
  @@index([sovereignBankId])
  @@index([status])
}

model psg_state_blocks {
  id                    String               @id
  blockId               String               @unique
  epochId               String?
  nodeId                String?
  scbBlocks             Json
  cbdcTransactions      Json?
  commodityTransactions Json?
  securityTransactions  Json?
  stateHash             String
  previousBlockHash     String?
  status                String               @default("pending")
  committedAt           DateTime?
  createdAt             DateTime             @default(now())
  updatedAt             DateTime
  settlement_epochs     settlement_epochs?   @relation(fields: [epochId], references: [id])
  psg_sovereign_nodes   psg_sovereign_nodes? @relation(fields: [nodeId], references: [id])

  @@index([blockId])
  @@index([epochId])
  @@index([nodeId])
  @@index([stateHash])
  @@index([status])
}

model public_market_operations {
  id              String    @id
  pmoId           String    @unique
  sovereignBankId String
  operationType   String
  operationData   Json
  status          String    @default("pending")
  executedAt      DateTime?
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([operationType])
  @@index([pmoId])
  @@index([sovereignBankId])
  @@index([status])
}

model quantum_bond_coupons {
  id                String        @id
  couponId          String        @unique
  bondId            String
  couponAmount      Decimal       @db.Decimal(32, 8)
  paymentDate       DateTime
  quantumSettled    Boolean       @default(false)
  truthSamplingHash String?
  status            String        @default("pending")
  settledAt         DateTime?
  createdAt         DateTime      @default(now())
  updatedAt         DateTime
  quantum_bonds     quantum_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([couponId])
  @@index([status])
}

model quantum_bonds {
  id                          String                        @id
  bondId                      String                        @unique
  bondName                    String
  principalAmount             Decimal                       @db.Decimal(32, 8)
  bondType                    String
  quantumState                Json?
  truthSamplingHash           String?
  observerCount               Int                           @default(0)
  timelineStates              Json?
  mergedState                 Json?
  maturityDate                DateTime
  couponRate                  Decimal                       @db.Decimal(32, 8)
  status                      String                        @default("active")
  issuedAt                    DateTime                      @default(now())
  collapsedAt                 DateTime?
  mergedAt                    DateTime?
  createdAt                   DateTime                      @default(now())
  updatedAt                   DateTime
  quantum_bond_coupons        quantum_bond_coupons[]
  timeline_synchronized_bonds timeline_synchronized_bonds[]

  @@index([bondId])
  @@index([bondType])
  @@index([status])
}

model quantum_envelopes {
  id                           String                       @id
  envelopeId                   String                       @unique
  legacyTransactionId          String
  legacyProtocol               String
  quantumHash                  String
  causalConsistencyHash        String
  dimensionalHarmonizationHash String
  transactionData              Json
  status                       String                       @default("created")
  createdAt                    DateTime                     @default(now())
  updatedAt                    DateTime
  quantum_proxy_transactions   quantum_proxy_transactions[]

  @@index([envelopeId])
  @@index([legacyProtocol])
  @@index([legacyTransactionId])
  @@index([status])
}

model quantum_hashes {
  id            String      @id
  hashId        String      @unique
  blockId       String?
  hashAlgorithm String
  hashValue     String
  originalData  Json?
  createdAt     DateTime    @default(now())
  gql_blocks    gql_blocks? @relation(fields: [blockId], references: [id])

  @@index([blockId])
  @@index([hashAlgorithm])
  @@index([hashId])
}

model quantum_ledger_interfaces {
  id                    String                @id
  interfaceId           String                @unique
  ledgerId              String
  gqlStateAccess        Boolean               @default(true)
  entanglementSnapshot  Json?
  status                String                @default("active")
  lastSyncAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  multi_reality_ledgers multi_reality_ledgers @relation(fields: [ledgerId], references: [id], onDelete: Cascade)

  @@index([interfaceId])
  @@index([ledgerId])
  @@index([status])
}

model quantum_migration_phases {
  id               String             @id
  phaseNumber      Int
  phaseName        String
  description      String
  targetComponents Json
  status           String             @default("planned")
  startDate        DateTime?
  completionDate   DateTime?
  createdAt        DateTime           @default(now())
  updatedAt        DateTime
  migration_audits migration_audits[]

  @@index([phaseNumber])
  @@index([status])
}

model quantum_proxy_transactions {
  id                   String                @id
  proxyTransactionId   String                @unique
  legacyTransactionId  String
  legacyProtocol       String
  quantumEnvelopeId    String?
  translationId        String?
  dbisQfsTransactionId String?
  sourceBankId         String
  destinationBankId    String
  amount               Decimal               @db.Decimal(32, 8)
  currencyCode         String
  status               String                @default("pending")
  bridgedAt            DateTime?
  createdAt            DateTime              @default(now())
  updatedAt            DateTime
  quantum_envelopes    quantum_envelopes?    @relation(fields: [quantumEnvelopeId], references: [envelopeId])
  quantum_translations quantum_translations? @relation(fields: [translationId], references: [translationId])

  @@index([destinationBankId])
  @@index([legacyProtocol])
  @@index([legacyTransactionId])
  @@index([proxyTransactionId])
  @@index([sourceBankId])
  @@index([status])
}

model quantum_reserve_states {
  id                      String                  @id
  stateId                 String                  @unique
  reserveId               String
  quantumState            Json
  probabilityAmplitude    Decimal                 @db.Decimal(32, 12)
  entanglementHash        String?
  coherence               Decimal?                @db.Decimal(32, 12)
  measuredAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  infinite_state_reserves infinite_state_reserves @relation(fields: [reserveId], references: [id], onDelete: Cascade)

  @@index([measuredAt])
  @@index([reserveId])
  @@index([stateId])
}

model quantum_state_commitments {
  id             String   @id
  commitmentId   String   @unique
  blockId        String?
  entangledHash  String?
  commitmentType String
  status         String   @default("pending")
  createdAt      DateTime @default(now())
  updatedAt      DateTime

  @@index([blockId])
  @@index([commitmentId])
}

model quantum_temporal_arbitrations {
  id                    String                  @id
  arbitrationId         String                  @unique
  arbitrationType       String
  status                String                  @default("pending")
  initiatedAt           DateTime                @default(now())
  resolvedAt            DateTime?
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  arbitration_decisions arbitration_decisions[]
  consistency_rollbacks consistency_rollbacks[]
  contradiction_events  contradiction_events[]

  @@index([arbitrationId])
  @@index([arbitrationType])
  @@index([status])
}

model quantum_translations {
  id                         String                       @id
  translationId              String                       @unique
  legacyProtocol             String
  legacyAmount               Decimal                      @db.Decimal(32, 8)
  legacyCurrency             String
  quantumAmount              Decimal                      @db.Decimal(32, 8)
  quantumCurrency            String
  fxRate                     Decimal                      @db.Decimal(32, 12)
  riskScore                  Decimal                      @db.Decimal(32, 8)
  protocolMapping            Json
  transactionData            Json
  status                     String                       @default("completed")
  createdAt                  DateTime                     @default(now())
  updatedAt                  DateTime
  quantum_proxy_transactions quantum_proxy_transactions[]

  @@index([legacyProtocol])
  @@index([status])
  @@index([translationId])
}

model quantum_wallet_capsules {
  id               String          @id
  capsuleId        String          @unique
  senderWalletId   String
  receiverWalletId String
  amount           Decimal         @db.Decimal(32, 8)
  timestamp        DateTime
  expiryWindow     Int
  doubleSpendToken String          @unique
  pqcSignature     String
  scbVerification  Boolean         @default(false)
  dbisVerification Boolean         @default(false)
  status           String          @default("pending")
  syncedAt         DateTime?
  createdAt        DateTime        @default(now())
  updatedAt        DateTime
  quantum_wallets  quantum_wallets @relation(fields: [senderWalletId], references: [id], onDelete: Cascade)

  @@index([capsuleId])
  @@index([doubleSpendToken])
  @@index([status])
}

model quantum_wallets {
  id                         String                       @id
  walletId                   String                       @unique
  sovereignBankId            String
  walletType                 String
  currencyCode               String
  balance                    Decimal                      @default(0) @db.Decimal(32, 8)
  dilithiumKeyId             String
  kyberKeyId                 String
  hsmIdentityCert            String
  waoId                      String?
  status                     String                       @default("active")
  createdAt                  DateTime                     @default(now())
  updatedAt                  DateTime
  quantum_wallet_capsules    quantum_wallet_capsules[]
  wallet_attestation_objects wallet_attestation_objects[]
  wallet_risk_scores         wallet_risk_scores[]

  @@index([sovereignBankId])
  @@index([status])
  @@index([walletId])
  @@index([walletType])
}

model reality_convergence {
  id                      String                    @id
  convergenceId           String                    @unique
  realityDivergence       Decimal                   @db.Decimal(32, 12)
  sovereignAlignment      Decimal                   @db.Decimal(32, 12)
  fxStability             Decimal                   @db.Decimal(32, 12)
  ssuStability            Decimal                   @db.Decimal(32, 12)
  cbdcStability           Decimal                   @db.Decimal(32, 12)
  convergence             Decimal                   @db.Decimal(32, 12)
  stable                  Boolean                   @default(false)
  status                  String                    @default("calculated")
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  economic_harmonizations economic_harmonizations[]
  reality_divergences     reality_divergences[]     @relation("RealityConvergenceToRealityDivergence")

  @@index([convergenceId])
  @@index([stable])
  @@index([status])
}

model reality_divergences {
  id                           String                       @id
  divergenceId                 String                       @unique
  indexId                      String
  sourceReality                String
  targetReality                String
  divergenceType               String
  divergenceMagnitude          Decimal                      @db.Decimal(32, 12)
  threshold                    Decimal                      @db.Decimal(32, 12)
  alertLevel                   String
  status                       String                       @default("detected")
  resolvedAt                   DateTime?
  createdAt                    DateTime                     @default(now())
  updatedAt                    DateTime
  multiverse_stability_indices multiverse_stability_indices @relation(fields: [indexId], references: [id], onDelete: Cascade)
  reality_convergence          reality_convergence[]        @relation("RealityConvergenceToRealityDivergence")

  @@index([alertLevel])
  @@index([divergenceId])
  @@index([indexId])
  @@index([sourceReality, targetReality])
}

model reality_layer_states {
  id                      String                  @id
  stateId                 String                  @unique
  matrixId                String
  realityLayer            String
  layerState              Json
  syncStatus              String                  @default("pending")
  lastSyncAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  omni_sovereign_matrices omni_sovereign_matrices @relation(fields: [matrixId], references: [id], onDelete: Cascade)

  @@index([matrixId])
  @@index([realityLayer])
  @@index([stateId])
  @@index([syncStatus])
}

model reality_layers {
  id                         String                       @id
  layerId                    String                       @unique
  layerName                  String
  layerType                  String
  authenticationStatus       String                       @default("pending")
  coherenceLevel             Decimal                      @db.Decimal(32, 12)
  status                     String                       @default("active")
  createdAt                  DateTime                     @default(now())
  updatedAt                  DateTime
  multiversal_monetary_units multiversal_monetary_units[]
  valuation_calculations     valuation_calculations[]
  monetary_unit_conversions  monetary_unit_conversions[]  @relation("MonetaryUnitConversionToRealityLayer")

  @@index([authenticationStatus])
  @@index([layerId])
  @@index([layerType])
}

model reality_spanning_contracts {
  id                   String                 @id
  contractId           String                 @unique
  contractHash         String
  contractCode         Json
  dimensions           Json
  timelines            Json?
  simulatedLayers      Json?
  quantumStates        Json?
  realityAgreement     Boolean                @default(false)
  agreementDetails     Json?
  status               String                 @default("pending")
  executionResult      Json?
  ossmResolution       Json?
  executedAt           DateTime?
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  contract_executions  contract_executions[]
  contract_resolutions contract_resolutions[]

  @@index([contractHash])
  @@index([contractId])
  @@index([realityAgreement])
  @@index([status])
}

model reality_states {
  id          String   @id
  realityId   String   @unique
  realityType String
  stateData   Json
  status      String   @default("active")
  createdAt   DateTime @default(now())
  updatedAt   DateTime

  @@index([realityId])
  @@index([realityType])
  @@index([status])
}

model regulatory_equivalence_scores {
  id              String   @id
  scoreId         String   @unique
  sovereignBankId String
  compliance      Decimal  @db.Decimal(5, 2)
  transparency    Decimal  @db.Decimal(5, 2)
  amlStrength     Decimal  @db.Decimal(5, 2)
  cbdcMaturity    Decimal  @db.Decimal(5, 2)
  repScore        Decimal  @db.Decimal(5, 2)
  equivalent      Boolean  @default(false)
  calculatedAt    DateTime @default(now())

  @@index([calculatedAt])
  @@index([equivalent])
  @@index([scoreId])
  @@index([sovereignBankId])
}

model regulatory_harmonization_rules {
  id                   String   @id
  pillar               String
  ruleCode             String
  name                 String
  description          String
  requirements         String[]
  applicableSovereigns String[]
  status               String   @default("ACTIVE")
  createdAt            DateTime @default(now())
  updatedAt            DateTime

  @@unique([pillar, ruleCode])
  @@index([pillar])
  @@index([ruleCode])
  @@index([status])
}

model reserve_verifications {
  id                   String              @id
  verificationId       String              @unique
  bondId               String
  verificationType     String
  reserveAmount        Decimal             @db.Decimal(32, 8)
  reserveType          String
  commodityType        String?
  custodianId          String?
  certificateHash      String?
  verificationStatus   String              @default("pending")
  verifiedAt           DateTime?
  nextVerificationDate DateTime?
  createdAt            DateTime            @default(now())
  updatedAt            DateTime
  supranational_bonds  supranational_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([verificationId])
  @@index([verificationStatus])
}

model risk_tiers {
  id         String   @id
  entityId   String   @unique
  riskTier   String
  assignedAt DateTime @default(now())
  updatedAt  DateTime

  @@index([entityId])
  @@index([riskTier])
}

model rulebook_rules {
  id              String    @id
  ruleId          String    @unique
  ruleCategory    String
  ruleName        String
  ruleDescription String
  ruleLogic       Json
  status          String    @default("active")
  effectiveDate   DateTime
  expiryDate      DateTime?
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([ruleCategory])
  @@index([status])
}

model sanctions_lists {
  id            String    @id
  entityName    String
  entityType    String
  listSource    String
  listId        String
  status        String    @default("active")
  effectiveDate DateTime
  expiryDate    DateTime?
  metadata      Json?
  createdAt     DateTime  @default(now())
  updatedAt     DateTime

  @@index([entityName])
  @@index([listSource])
  @@index([status])
}

model sdip_revocations {
  id                                   String                               @id
  revocationId                         String                               @unique
  passportId                           String
  reason                               String
  revokedBy                            String
  createdAt                            DateTime                             @default(now())
  sovereign_digital_identity_passports sovereign_digital_identity_passports @relation(fields: [passportId], references: [id], onDelete: Cascade)

  @@index([passportId])
  @@index([revocationId])
}

model securities {
  id           String   @id
  securityId   String   @unique
  securityType String
  issuer       String
  currencyCode String
  quantity     Decimal  @db.Decimal(32, 8)
  price        Decimal? @db.Decimal(32, 12)
  status       String   @default("active")
  createdAt    DateTime @default(now())
  updatedAt    DateTime

  @@index([securityId])
  @@index([securityType])
}

model securities_sub_ledger {
  id            String   @id
  ledgerEntryId String   @unique
  securityId    String
  securityType  String
  quantity      Decimal  @db.Decimal(32, 8)
  price         Decimal? @db.Decimal(32, 12)
  createdAt     DateTime @default(now())

  @@index([securityId])
}

model settlement_arbitrations {
  id                  String              @id
  arbitrationId       String              @unique
  disputeId           String
  tribunalDecision    String
  decisionType        String
  status              String              @default("pending")
  decidedAt           DateTime?
  enforcedAt          DateTime?
  createdAt           DateTime            @default(now())
  updatedAt           DateTime
  settlement_disputes settlement_disputes @relation(fields: [disputeId], references: [id], onDelete: Cascade)

  @@index([arbitrationId])
  @@index([disputeId])
  @@index([status])
}

model settlement_coordinates {
  id                      String                  @id
  coordinateId            String                  @unique
  matrixId                String
  sovereignIndex          Int
  assetIndex              Int
  temporalIndex           Int
  realityIndex            Int
  settlementState         Json
  settlementStatus        String                  @default("pending")
  lastSyncAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  omni_sovereign_matrices omni_sovereign_matrices @relation(fields: [matrixId], references: [id], onDelete: Cascade)

  @@index([coordinateId])
  @@index([matrixId])
  @@index([settlementStatus])
  @@index([sovereignIndex, assetIndex, temporalIndex, realityIndex])
}

model settlement_disputes {
  id                      String                    @id
  disputeId               String                    @unique
  transactionId           String
  articleId               String
  party1BankId            String
  party2BankId            String
  disputeType             String
  description             String
  stage                   String                    @default("bilateral")
  status                  String                    @default("active")
  resolution              String?
  resolvedAt              DateTime?
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  settlement_arbitrations settlement_arbitrations[]
  settlement_law_articles settlement_law_articles   @relation(fields: [articleId], references: [id], onDelete: Cascade)

  @@index([articleId])
  @@index([disputeId])
  @@index([stage])
  @@index([status])
  @@index([transactionId])
}

model settlement_epochs {
  id                  String               @id
  epochId             String               @unique
  gridId              String?
  nodeId              String?
  assetType           String
  epochInterval       Int
  epochNumber         Int
  stateHash           String
  committedAt         DateTime             @default(now())
  status              String               @default("committed")
  createdAt           DateTime             @default(now())
  updatedAt           DateTime
  psg_state_blocks    psg_state_blocks[]
  psg_master_grids    psg_master_grids?    @relation(fields: [gridId], references: [id])
  psg_sovereign_nodes psg_sovereign_nodes? @relation(fields: [nodeId], references: [id])

  @@index([assetType])
  @@index([epochId])
  @@index([epochNumber])
  @@index([gridId])
  @@index([nodeId])
}

model settlement_finalities {
  id                      String                  @id
  finalityId              String                  @unique
  transactionId           String
  articleId               String
  masterLedgerCommit      Boolean                 @default(false)
  legalBinding            Boolean                 @default(false)
  principle               String
  status                  String                  @default("pending")
  finalizedAt             DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  settlement_law_articles settlement_law_articles @relation(fields: [articleId], references: [id], onDelete: Cascade)

  @@index([articleId])
  @@index([finalityId])
  @@index([status])
  @@index([transactionId])
}

model settlement_law_articles {
  id                    String                  @id
  articleId             String                  @unique
  articleNumber         String
  articleTitle          String
  content               String
  principle             String?
  version               Int                     @default(1)
  effectiveDate         DateTime
  expiryDate            DateTime?
  status                String                  @default("active")
  metadata              Json?
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  settlement_disputes   settlement_disputes[]
  settlement_finalities settlement_finalities[]

  @@index([articleId])
  @@index([articleNumber])
  @@index([principle])
  @@index([status])
}

model settlement_routes {
  id                     String                   @id
  routeId                String                   @unique
  sourceBankId           String
  destinationBankId      String
  currencyCode           String
  routeType              String
  intermediaryBankIds    Json?
  liquidityProximity     Decimal?                 @db.Decimal(32, 8)
  trustWeight            Decimal?                 @db.Decimal(32, 8)
  fxCost                 Decimal?                 @db.Decimal(32, 12)
  estimatedLatency       Int?
  sireCost               Decimal?                 @db.Decimal(32, 12)
  sriRiskScore           Decimal?                 @db.Decimal(32, 8)
  liquidityPenalty       Decimal?                 @db.Decimal(32, 8)
  ssuAdjustment          Decimal?                 @db.Decimal(32, 8)
  status                 String                   @default("active")
  lastUsedAt             DateTime?
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  sire_routing_decisions sire_routing_decisions[]

  @@index([currencyCode])
  @@index([destinationBankId])
  @@index([routeId])
  @@index([sourceBankId])
  @@index([status])
}

model sevm_contracts {
  id                      String                  @id
  contractId              String                  @unique
  zoneId                  String
  contractType            String
  contractAddress         String
  contractCode            String
  contractHash            String
  deployerBankId          String
  status                  String                  @default("pending")
  deployedAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  sovereign_compute_zones sovereign_compute_zones @relation(fields: [zoneId], references: [id], onDelete: Cascade)

  @@index([contractAddress])
  @@index([contractId])
  @@index([contractType])
  @@index([status])
  @@index([zoneId])
}

model simulation_interfaces {
  id                    String                @id
  interfaceId           String                @unique
  ledgerId              String
  simulationType        String
  simulationState       Json?
  status                String                @default("active")
  lastSyncAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  multi_reality_ledgers multi_reality_ledgers @relation(fields: [ledgerId], references: [id], onDelete: Cascade)

  @@index([interfaceId])
  @@index([ledgerId])
  @@index([status])
}

model simulation_layers {
  id                    String                @id
  layerId               String                @unique
  simulationId          String
  layerType             String
  layerConfig           Json
  layerData             Json?
  status                String                @default("active")
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  sovereign_simulations sovereign_simulations @relation(fields: [simulationId], references: [id], onDelete: Cascade)

  @@index([layerId])
  @@index([layerType])
  @@index([simulationId])
  @@index([status])
}

model simulation_outcomes {
  id                    String                @id
  outcomeId             String                @unique
  simulationId          String
  outcomeType           String
  outcomeData           Json
  projection            Json?
  accuracy              Decimal?              @db.Decimal(32, 12)
  status                String                @default("pending")
  calculatedAt          DateTime              @default(now())
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  sovereign_simulations sovereign_simulations @relation(fields: [simulationId], references: [id], onDelete: Cascade)

  @@index([outcomeId])
  @@index([outcomeType])
  @@index([simulationId])
  @@index([status])
}

model simulation_scenarios {
  id                    String                @id
  scenarioId            String                @unique
  simulationId          String                @unique
  scenarioName          String
  scenarioType          String
  scenarioConfig        Json
  stressLevel           String
  status                String                @default("active")
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  sovereign_simulations sovereign_simulations @relation(fields: [simulationId], references: [id], onDelete: Cascade)

  @@index([scenarioId])
  @@index([scenarioType])
  @@index([simulationId])
  @@index([status])
}

model singularity_liquidity {
  id                String          @id
  liquidityId       String          @unique
  generationId      String?
  gapId             String?         @unique
  liquidityAmount   Decimal         @db.Decimal(32, 12)
  generationType    String
  conservationLimit Decimal?        @db.Decimal(32, 12)
  withinLimits      Boolean         @default(true)
  status            String          @default("active")
  createdAt         DateTime        @default(now())
  updatedAt         DateTime
  liquidity_gaps    liquidity_gaps? @relation(fields: [gapId], references: [id])

  @@index([gapId])
  @@index([generationId])
  @@index([liquidityId])
  @@index([status])
}

model sire_routing_decisions {
  id                   String                @id
  decisionId           String                @unique
  sourceBankId         String
  destinationBankId    String
  routeId              String?
  routeType            String
  optimalRoute         Json
  fxCost               Decimal?              @db.Decimal(32, 12)
  sriRiskScore         Decimal?              @db.Decimal(32, 8)
  liquidityPenalty     Decimal?              @db.Decimal(32, 8)
  ssuAdjustment        Decimal?              @db.Decimal(32, 8)
  totalCost            Decimal               @db.Decimal(32, 12)
  decisionTimestamp    DateTime              @default(now())
  createdAt            DateTime              @default(now())
  updatedAt            DateTime
  settlement_routes    settlement_routes?    @relation(fields: [routeId], references: [id])
  sire_routing_metrics sire_routing_metrics?

  @@index([decisionId])
  @@index([destinationBankId])
  @@index([routeId])
  @@index([sourceBankId])
}

model sire_routing_metrics {
  id                      String                 @id
  metricsId               String                 @unique
  decisionId              String                 @unique
  fxVolatility            Decimal?               @db.Decimal(32, 12)
  liquidityBufferLevel    Decimal?               @db.Decimal(32, 8)
  sriScore                Decimal?               @db.Decimal(32, 8)
  syntheticSettlementCost Decimal?               @db.Decimal(32, 12)
  commodityIndex          Json?
  calculatedAt            DateTime               @default(now())
  createdAt               DateTime               @default(now())
  updatedAt               DateTime
  sire_routing_decisions  sire_routing_decisions @relation(fields: [decisionId], references: [id], onDelete: Cascade)

  @@index([decisionId])
  @@index([metricsId])
}

model smart_contracts {
  id              String          @id
  contractId      String          @unique
  sovereignBankId String
  templateType    String
  contractState   String          @default("draft")
  parameters      Json
  signatories     Json
  signatures      Json?
  executionResult Json?
  createdAt       DateTime        @default(now())
  updatedAt       DateTime
  executedAt      DateTime?
  sovereign_banks sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([contractState])
  @@index([sovereignBankId])
  @@index([templateType])
}

model sovereign_attestations {
  id                      String                  @id
  attestationId           String                  @unique
  zoneId                  String
  attestationType         String
  attestationData         Json
  integrityHash           String
  status                  String                  @default("pending")
  verifiedAt              DateTime?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  sovereign_compute_zones sovereign_compute_zones @relation(fields: [zoneId], references: [id], onDelete: Cascade)

  @@index([attestationId])
  @@index([attestationType])
  @@index([status])
  @@index([zoneId])
}

model sovereign_banks {
  id                                                                       String                             @id
  sovereignCode                                                            String                             @unique
  name                                                                     String
  bic                                                                      String?                            @unique
  lei                                                                      String?                            @unique
  hsmIdentity                                                              String?
  rootSovereignKey                                                         String?
  status                                                                   String                             @default("active")
  createdAt                                                                DateTime                           @default(now())
  updatedAt                                                                DateTime
  aifx_trades                                                              aifx_trades[]
  bank_accounts                                                            bank_accounts[]
  bond_market_participants                                                 bond_market_participants[]
  cbdc_issuance                                                            cbdc_issuance[]
  chrono_settlements_chrono_settlements_destinationBankIdTosovereign_banks chrono_settlements[]               @relation("chrono_settlements_destinationBankIdTosovereign_banks")
  chrono_settlements_chrono_settlements_sourceBankIdTosovereign_banks      chrono_settlements[]               @relation("chrono_settlements_sourceBankIdTosovereign_banks")
  compliance_records                                                       compliance_records[]
  digital_sovereign_economic_zones                                         digital_sovereign_economic_zones[]
  face_economies                                                           face_economies[]
  fx_trades                                                                fx_trades[]
  holographic_anchors                                                      holographic_anchors[]
  infinite_layer_identities                                                infinite_layer_identities[]
  interbank_credit_lines                                                   interbank_credit_lines[]
  interplanetary_ssu_transactions                                          interplanetary_ssu_transactions[]
  iso_messages                                                             iso_messages[]
  liquidity_pools                                                          liquidity_pools[]
  meta_sovereign_council_members                                           meta_sovereign_council_members[]
  nostro_vostro_participants                                               nostro_vostro_participants[]
  smart_contracts                                                          smart_contracts[]
  sovereign_continuity_identities                                          sovereign_continuity_identities[]
  sovereign_identities                                                     sovereign_identities[]
  sovereign_privileges                                                     sovereign_privileges[]
  sovereign_settlement_nodes                                               sovereign_settlement_nodes[]
  supranational_entity_members                                             supranational_entity_members[]
  temporal_currency_transactions                                           temporal_currency_transactions[]
  ummc_sovereign_mappings                                                  ummc_sovereign_mappings[]

  @@index([bic])
  @@index([sovereignCode])
}

model sovereign_compute_zones {
  id                     String                   @id
  zoneId                 String                   @unique
  sovereignBankId        String
  zoneName               String
  zoneType               String
  region                 String
  zeroTrustConfig        Json
  pqHsmConfig            Json?
  status                 String                   @default("active")
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  sevm_contracts         sevm_contracts[]
  sovereign_attestations sovereign_attestations[]
  sovereign_replications sovereign_replications[]

  @@index([sovereignBankId])
  @@index([status])
  @@index([zoneId])
}

model sovereign_continuity_identities {
  id                        String                      @id
  continuityId              String                      @unique
  sovereignBankId           String
  unifiedIdentity           String
  classicalIdentity         String?
  quantumIdentity           String?
  holographicIdentity       String?
  parallelIdentity          Json?
  temporalIdentity          String?
  status                    String                      @default("active")
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime
  multiverse_state_mappings multiverse_state_mappings[]
  sovereign_banks           sovereign_banks             @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([continuityId])
  @@index([sovereignBankId])
  @@index([status])
}

model sovereign_debt_instruments {
  id                String   @id
  instrumentId      String   @unique
  issuerBankId      String
  participantBankId String
  instrumentType    String
  amount            Decimal  @db.Decimal(32, 8)
  currencyCode      String
  maturityDate      DateTime
  participantType   String
  status            String   @default("active")
  issuedAt          DateTime @default(now())
  createdAt         DateTime @default(now())
  updatedAt         DateTime

  @@index([instrumentId])
  @@index([issuerBankId])
  @@index([participantBankId])
  @@index([participantType])
  @@index([status])
}

model sovereign_digital_identity_passports {
  id               String             @id
  passportId       String             @unique
  entityType       String
  entityId         String
  sovereignIssuer  String
  rootCert         String
  pqSignature      String
  trustLevel       String
  expiry           DateTime
  revocationStatus String             @default("ACTIVE")
  attributes       Json
  createdAt        DateTime           @default(now())
  updatedAt        DateTime
  sdip_revocations sdip_revocations[]

  @@index([entityId])
  @@index([passportId])
  @@index([revocationStatus])
  @@index([sovereignIssuer])
  @@index([trustLevel])
}

model sovereign_graph_security_engines {
  id               String             @id
  sgseId           String             @unique
  graphType        String
  graphData        Json
  nodeCount        Int?
  edgeCount        Int?
  lastUpdated      DateTime           @default(now())
  status           String             @default("active")
  createdAt        DateTime           @default(now())
  updatedAt        DateTime
  ledger_anomalies ledger_anomalies[]

  @@index([graphType])
  @@index([sgseId])
  @@index([status])
}

model sovereign_guarantees {
  id                String   @id
  guaranteeId       String   @unique
  guarantorBankId   String
  beneficiaryBankId String
  amount            Decimal  @db.Decimal(32, 8)
  currencyCode      String
  guaranteeType     String
  expiryDate        DateTime
  status            String   @default("active")
  contractReference String?
  createdAt         DateTime @default(now())
  updatedAt         DateTime

  @@index([guaranteeId])
  @@index([status])
}

model sovereign_identities {
  id               String          @id
  sovereignBankId  String
  identityType     String
  identityKey      String
  hsmKeyId         String?
  certificate      String?
  quantumKeyId     String?
  isQuantumEnabled Boolean         @default(false)
  status           String          @default("active")
  createdAt        DateTime        @default(now())
  updatedAt        DateTime
  sovereign_banks  sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([identityType])
  @@index([quantumKeyId])
  @@index([sovereignBankId])
}

model sovereign_liquidity_ratios {
  id              String   @id
  sovereignBankId String   @unique
  ratio           Decimal  @db.Decimal(5, 2)
  riskFactors     String[]
  calculatedAt    DateTime @default(now())
  updatedAt       DateTime

  @@index([calculatedAt])
  @@index([ratio])
  @@index([sovereignBankId])
}

model sovereign_privileges {
  id               String          @id
  privilegeId      String          @unique
  sovereignBankId  String
  privilegeType    String
  status           String          @default("active")
  suspensionReason String?
  suspendedAt      DateTime?
  restoredAt       DateTime?
  createdAt        DateTime        @default(now())
  updatedAt        DateTime
  sovereign_banks  sovereign_banks @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([privilegeId])
  @@index([privilegeType])
  @@index([sovereignBankId])
  @@index([status])
}

model sovereign_replications {
  id                      String                  @id
  replicationId           String                  @unique
  zoneId                  String
  targetZoneId            String
  replicationType         String
  metadataHash            String
  lastHashTime            DateTime
  status                  String                  @default("active")
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  sovereign_compute_zones sovereign_compute_zones @relation(fields: [zoneId], references: [id], onDelete: Cascade)

  @@index([replicationId])
  @@index([status])
  @@index([targetZoneId])
  @@index([zoneId])
}

model sovereign_reports {
  id              String    @id
  sovereignBankId String
  reportId        String    @unique
  reportType      String
  reportPeriod    String
  reportDate      DateTime
  dueDate         DateTime
  status          String    @default("pending")
  reportData      Json
  submittedAt     DateTime?
  reviewedAt      DateTime?
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([reportDate])
  @@index([reportId])
  @@index([reportType])
  @@index([sovereignBankId])
  @@index([status])
}

model sovereign_risk_indices {
  id               String             @id
  sovereignBankId  String
  sriScore         Decimal            @db.Decimal(32, 8)
  sriRating        String
  calculatedAt     DateTime           @default(now())
  effectiveDate    DateTime           @default(now())
  status           String             @default("active")
  metadata         Json?
  sri_enforcements sri_enforcements[]
  sri_inputs       sri_inputs[]

  @@index([calculatedAt])
  @@index([sovereignBankId])
  @@index([sriRating])
  @@index([sriScore])
}

model sovereign_settlement_nodes {
  id                String              @id
  nodeId            String              @unique
  sovereignBankId   String
  layer             String
  nodeType          String
  status            String              @default("active")
  lastSyncAt        DateTime?
  metadata          Json?
  createdAt         DateTime            @default(now())
  updatedAt         DateTime
  gss_master_ledger gss_master_ledger[]
  sovereign_banks   sovereign_banks     @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
  state_blocks      state_blocks[]

  @@index([layer])
  @@index([nodeId])
  @@index([sovereignBankId])
  @@index([status])
}

model sovereign_simulations {
  id                   String                @id
  simulationId         String                @unique
  simulationName       String
  simulationType       String
  status               String                @default("running")
  startedAt            DateTime              @default(now())
  completedAt          DateTime?
  createdAt            DateTime              @default(now())
  updatedAt            DateTime
  simulation_layers    simulation_layers[]
  simulation_outcomes  simulation_outcomes[]
  simulation_scenarios simulation_scenarios?

  @@index([simulationId])
  @@index([simulationType])
  @@index([status])
}

model sovereign_stablecoins {
  id                     String                   @id
  stablecoinId           String                   @unique
  issuerBankId           String
  stablecoinCode         String                   @unique
  name                   String
  totalSupply            Decimal                  @default(0) @db.Decimal(32, 8)
  collateralizationRatio Decimal                  @db.Decimal(32, 12)
  status                 String                   @default("active")
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime
  stablecoin_audits      stablecoin_audits[]
  stablecoin_collaterals stablecoin_collaterals[]
  stablecoin_reserves    stablecoin_reserves[]

  @@index([issuerBankId])
  @@index([stablecoinCode])
  @@index([stablecoinId])
  @@index([status])
}

model sri_enforcements {
  id                     String                 @id
  sriId                  String
  sovereignBankId        String
  triggerLevel           String
  enforcementType        String
  action                 String
  status                 String                 @default("active")
  executedAt             DateTime?
  resolvedAt             DateTime?
  metadata               Json?
  createdAt              DateTime               @default(now())
  updatedAt              DateTime
  sovereign_risk_indices sovereign_risk_indices @relation(fields: [sriId], references: [id], onDelete: Cascade)

  @@index([sovereignBankId])
  @@index([sriId])
  @@index([status])
  @@index([triggerLevel])
}

model sri_inputs {
  id                     String                 @id
  sriId                  String
  inputCategory          String
  inputType              String
  inputValue             Decimal                @db.Decimal(32, 8)
  weight                 Decimal?               @db.Decimal(32, 8)
  source                 String?
  timestamp              DateTime               @default(now())
  sovereign_risk_indices sovereign_risk_indices @relation(fields: [sriId], references: [id], onDelete: Cascade)

  @@index([inputCategory])
  @@index([inputType])
  @@index([sriId])
}

model ssu_compositions {
  id                         String                     @id
  ssuId                      String
  currencyWeight             Decimal                    @db.Decimal(32, 8)
  commodityWeight            Decimal                    @db.Decimal(32, 8)
  cbdcWeight                 Decimal                    @db.Decimal(32, 8)
  lamWeight                  Decimal                    @db.Decimal(32, 8)
  topSovereigns              Json
  commodities                Json
  cbdcs                      Json
  calculatedAt               DateTime                   @default(now())
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  synthetic_settlement_units synthetic_settlement_units @relation(fields: [ssuId], references: [id], onDelete: Cascade)

  @@index([ssuId])
}

model ssu_redemption_requests {
  id                         String                     @id
  requestId                  String                     @unique
  ssuId                      String
  sovereignBankId            String
  amount                     Decimal                    @db.Decimal(32, 8)
  targetAssetType            String
  targetCurrencyCode         String?
  status                     String                     @default("pending")
  processedAt                DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  synthetic_settlement_units synthetic_settlement_units @relation(fields: [ssuId], references: [id], onDelete: Cascade)

  @@index([requestId])
  @@index([sovereignBankId])
  @@index([ssuId])
  @@index([status])
}

model ssu_transactions {
  id                         String                     @id
  transactionId              String                     @unique
  ssuId                      String
  transactionType            String
  amount                     Decimal                    @db.Decimal(32, 8)
  sourceBankId               String?
  destinationBankId          String?
  settlementId               String?
  status                     String                     @default("pending")
  completedAt                DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  synthetic_settlement_units synthetic_settlement_units @relation(fields: [ssuId], references: [id], onDelete: Cascade)

  @@index([ssuId])
  @@index([status])
  @@index([transactionId])
  @@index([transactionType])
}

model stability_calculations {
  id                           String                       @id
  calculationId                String                       @unique
  indexId                      String
  calculationType              String
  inputData                    Json
  calculationResult            Decimal                      @db.Decimal(32, 12)
  calculationFormula           Json
  status                       String                       @default("active")
  calculatedAt                 DateTime                     @default(now())
  createdAt                    DateTime                     @default(now())
  updatedAt                    DateTime
  multiverse_stability_indices multiverse_stability_indices @relation(fields: [indexId], references: [id], onDelete: Cascade)

  @@index([calculationId])
  @@index([calculationType])
  @@index([indexId])
}

model stablecoin_audits {
  id                    String                @id
  auditId               String                @unique
  stablecoinId          String
  auditDate             DateTime
  auditType             String
  hsmSignature          String?
  zkProof               String?
  auditResult           Json
  status                String                @default("pending")
  verifiedAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  sovereign_stablecoins sovereign_stablecoins @relation(fields: [stablecoinId], references: [id], onDelete: Cascade)

  @@index([auditDate])
  @@index([auditId])
  @@index([auditType])
  @@index([stablecoinId])
  @@index([status])
}

model stablecoin_collaterals {
  id                    String                @id
  collateralId          String                @unique
  stablecoinId          String
  assetType             String
  assetId               String?
  amount                Decimal               @db.Decimal(32, 8)
  valuation             Decimal               @db.Decimal(32, 12)
  status                String                @default("active")
  allocatedAt           DateTime              @default(now())
  releasedAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  sovereign_stablecoins sovereign_stablecoins @relation(fields: [stablecoinId], references: [id], onDelete: Cascade)

  @@index([assetType])
  @@index([collateralId])
  @@index([stablecoinId])
  @@index([status])
}

model stablecoin_reserves {
  id                     String                @id
  reserveId              String                @unique
  stablecoinId           String
  snapshotDate           DateTime
  totalReserves          Decimal               @db.Decimal(32, 8)
  totalSupply            Decimal               @db.Decimal(32, 8)
  collateralizationRatio Decimal               @db.Decimal(32, 12)
  reserveBreakdown       Json
  status                 String                @default("pending")
  verifiedAt             DateTime?
  createdAt              DateTime              @default(now())
  updatedAt              DateTime
  sovereign_stablecoins  sovereign_stablecoins @relation(fields: [stablecoinId], references: [id], onDelete: Cascade)

  @@index([reserveId])
  @@index([snapshotDate])
  @@index([stablecoinId])
  @@index([status])
}

model state_blocks {
  id                         String                     @id
  blockId                    String                     @unique
  nodeId                     String
  transactionPayload         Json
  sovereignSignature         String
  hashLock                   String
  blockHash                  String
  previousBlockHash          String?
  status                     String                     @default("locked")
  finalizedAt                DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  sovereign_settlement_nodes sovereign_settlement_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([blockId])
  @@index([hashLock])
  @@index([nodeId])
  @@index([status])
}

model superposition_assets {
  id                    String                  @id
  assetId               String                  @unique
  assetType             String
  assetName             String
  superpositionStates   Json
  stateProbabilities    Json
  superposedValue       Decimal?                @db.Decimal(32, 12)
  collapsedValue        Decimal?                @db.Decimal(32, 12)
  collapseStatus        String                  @default("superposed")
  collapsedAt           DateTime?
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  asset_reconciliations asset_reconciliations[]
  asset_valuations      asset_valuations[]

  @@index([assetId])
  @@index([assetType])
  @@index([collapseStatus])
}

model supervision_rules {
  id            String    @id
  ruleId        String    @unique
  ruleName      String
  ruleType      String
  ruleLogic     Json
  threshold     Decimal?  @db.Decimal(32, 8)
  severity      String
  status        String    @default("active")
  effectiveDate DateTime
  expiryDate    DateTime?
  createdAt     DateTime  @default(now())
  updatedAt     DateTime

  @@index([ruleId])
  @@index([ruleType])
  @@index([status])
}

model supervisory_dashboards {
  id              String   @id
  dashboardId     String   @unique
  sovereignBankId String?
  dashboardType   String
  metrics         Json
  lastUpdated     DateTime @default(now())
  createdAt       DateTime @default(now())
  updatedAt       DateTime

  @@index([dashboardId])
  @@index([dashboardType])
  @@index([sovereignBankId])
}

model supra_constitutional_charter {
  id                        String                      @id
  charterId                 String                      @unique
  version                   String
  effectiveDate             DateTime                    @default(now())
  status                    String                      @default("active")
  metaSovereignPrimacy      Boolean                     @default(true)
  dimensionalConsistency    Boolean                     @default(true)
  temporalNonContradiction  Boolean                     @default(true)
  economicCausality         Boolean                     @default(true)
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime
  ai_autonomous_actions     ai_autonomous_actions[]
  charter_articles          charter_articles[]
  temporal_integrity_checks temporal_integrity_checks[]

  @@index([charterId])
  @@index([status])
  @@index([version])
}

model supra_fund_loans {
  id                 String           @id
  loanId             String           @unique
  nodeId             String
  borrowerBankId     String
  loanAmount         Decimal          @db.Decimal(32, 8)
  currencyCode       String
  sriFactor          Decimal          @db.Decimal(32, 12)
  reserveStrength    Decimal          @db.Decimal(32, 12)
  fxExposure         Decimal          @db.Decimal(32, 12)
  liquidityShortfall Decimal          @db.Decimal(32, 12)
  loanEligibility    Decimal          @db.Decimal(32, 12)
  interestRate       Decimal?         @db.Decimal(32, 12)
  maturityDate       DateTime?
  status             String           @default("pending")
  approvedAt         DateTime?
  disbursedAt        DateTime?
  createdAt          DateTime         @default(now())
  updatedAt          DateTime
  supra_fund_nodes   supra_fund_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([borrowerBankId])
  @@index([loanId])
  @@index([nodeId])
  @@index([status])
}

model supra_fund_nodes {
  id                         String                       @id
  nodeId                     String                       @unique
  nodeType                   String
  nodeName                   String
  fundType                   String
  totalAssets                Decimal                      @db.Decimal(32, 8)
  availableLiquidity         Decimal                      @db.Decimal(32, 8)
  status                     String                       @default("active")
  createdAt                  DateTime                     @default(now())
  updatedAt                  DateTime
  crisis_stabilization_nodes crisis_stabilization_nodes[]
  development_fund_nodes     development_fund_nodes[]
  supra_fund_loans           supra_fund_loans[]
  supra_fund_settlements     supra_fund_settlements[]

  @@index([fundType])
  @@index([nodeId])
  @@index([nodeType])
  @@index([status])
}

model supra_fund_settlements {
  id               String           @id
  settlementId     String           @unique
  nodeId           String
  loanId           String?
  disbursementType String
  amount           Decimal          @db.Decimal(32, 8)
  currencyCode     String
  assetId          String?
  status           String           @default("pending")
  disbursedAt      DateTime?
  settledAt        DateTime?
  createdAt        DateTime         @default(now())
  updatedAt        DateTime
  supra_fund_nodes supra_fund_nodes @relation(fields: [nodeId], references: [id], onDelete: Cascade)

  @@index([loanId])
  @@index([nodeId])
  @@index([settlementId])
  @@index([status])
}

model supra_sovereign_relay_hubs {
  id               String            @id
  hubId            String            @unique
  gridId           String?
  hubName          String
  region           String
  optimizedRoutes  Json?
  latencyStats     Json?
  status           String            @default("active")
  createdAt        DateTime          @default(now())
  updatedAt        DateTime
  psg_master_grids psg_master_grids? @relation(fields: [gridId], references: [id])

  @@index([gridId])
  @@index([hubId])
  @@index([region])
  @@index([status])
}

model supra_sovereign_threats {
  id                          String                        @id
  threatId                    String                        @unique
  threatCategory              String
  threatType                  String
  severity                    String
  affectedBanks               Json?
  coordinationLevel           String?
  description                 String
  detectedAt                  DateTime                      @default(now())
  status                      String                        @default("detected")
  resolvedAt                  DateTime?
  createdAt                   DateTime                      @default(now())
  updatedAt                   DateTime
  coordinated_threat_patterns coordinated_threat_patterns[]
  threat_mitigations          threat_mitigations[]

  @@index([severity])
  @@index([status])
  @@index([threatCategory])
  @@index([threatId])
  @@index([threatType])
}

model supranational_bond_coupons {
  id                  String              @id
  couponId            String              @unique
  bondId              String
  couponAmount        Decimal             @db.Decimal(32, 8)
  paymentDate         DateTime
  status              String              @default("pending")
  paidAt              DateTime?
  createdAt           DateTime            @default(now())
  updatedAt           DateTime
  supranational_bonds supranational_bonds @relation(fields: [bondId], references: [id], onDelete: Cascade)

  @@index([bondId])
  @@index([couponId])
  @@index([status])
}

model supranational_bonds {
  id                         String                       @id
  bondId                     String                       @unique
  bondType                   String
  bondName                   String
  principalAmount            Decimal                      @db.Decimal(32, 8)
  supranationalCouncilId     String
  reserveBacking             Json
  commodityIndex             String?
  maturityDate               DateTime
  couponRate                 Decimal                      @db.Decimal(32, 8)
  status                     String                       @default("active")
  issuedAt                   DateTime                     @default(now())
  createdAt                  DateTime                     @default(now())
  updatedAt                  DateTime
  reserve_verifications      reserve_verifications[]
  supranational_bond_coupons supranational_bond_coupons[]

  @@index([bondId])
  @@index([bondType])
  @@index([status])
  @@index([supranationalCouncilId])
}

model supranational_entities {
  id                                String                              @id
  entityId                          String                              @unique
  entityCode                        String                              @unique
  entityName                        String
  entityType                        String
  description                       String
  status                            String                              @default("active")
  createdAt                         DateTime                            @default(now())
  updatedAt                         DateTime
  gru_issuances                     gru_issuances[]
  gru_reserve_pools                 gru_reserve_pools[]
  gru_supranational_reserve_classes gru_supranational_reserve_classes[]
  supranational_entity_members      supranational_entity_members[]

  @@index([entityCode])
  @@index([entityId])
  @@index([entityType])
  @@index([status])
}

model supranational_entity_members {
  id                     String                 @id
  memberId               String                 @unique
  entityId               String
  sovereignBankId        String
  membershipType         String
  status                 String                 @default("active")
  joinedAt               DateTime               @default(now())
  createdAt              DateTime               @default(now())
  updatedAt              DateTime
  supranational_entities supranational_entities @relation(fields: [entityId], references: [id], onDelete: Cascade)
  sovereign_banks        sovereign_banks        @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([entityId])
  @@index([memberId])
  @@index([sovereignBankId])
  @@index([status])
}

model suspicious_activity_reports {
  id            String    @id
  reportId      String    @unique
  transactionId String?
  reportType    String
  severity      String
  description   String
  status        String    @default("pending")
  submittedAt   DateTime?
  createdAt     DateTime  @default(now())

  @@index([reportId])
  @@index([status])
}

model suspicious_activity_scores {
  id            String   @id
  sasId         String   @unique
  transactionId String
  entityId      String
  score         Decimal  @db.Decimal(5, 2)
  factors       Json
  riskTier      String
  calculatedAt  DateTime @default(now())

  @@index([calculatedAt])
  @@index([entityId])
  @@index([riskTier])
  @@index([sasId])
  @@index([transactionId])
}

model synthetic_derivative_collaterals {
  id                    String                @id
  collateralId          String                @unique
  derivativeId          String
  assetType             String
  assetId               String?
  amount                Decimal               @db.Decimal(32, 8)
  valuation             Decimal               @db.Decimal(32, 12)
  marginRequirement     Decimal               @db.Decimal(32, 12)
  status                String                @default("active")
  allocatedAt           DateTime              @default(now())
  releasedAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  synthetic_derivatives synthetic_derivatives @relation(fields: [derivativeId], references: [id], onDelete: Cascade)

  @@index([assetType])
  @@index([collateralId])
  @@index([derivativeId])
  @@index([status])
}

model synthetic_derivative_settlements {
  id                    String                @id
  settlementId          String                @unique
  derivativeId          String
  settlementAmount      Decimal               @db.Decimal(32, 8)
  currencyCode          String
  assetType             String
  hashLock              String?
  sovereignLedgerHash   String?
  dbisLedgerHash        String?
  dualLedgerCommit      Boolean               @default(false)
  status                String                @default("pending")
  committedAt           DateTime?
  settledAt             DateTime?
  finalizedAt           DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime
  synthetic_derivatives synthetic_derivatives @relation(fields: [derivativeId], references: [id], onDelete: Cascade)

  @@index([derivativeId])
  @@index([hashLock])
  @@index([settlementId])
  @@index([status])
}

model synthetic_derivatives {
  id                               String                             @id
  derivativeId                     String                             @unique
  derivativeType                   String
  party1BankId                     String
  party2BankId                     String?
  underlyingAsset                  String
  notionalAmount                   Decimal                            @db.Decimal(32, 8)
  contractTerms                    Json
  smartContractId                  String?
  status                           String                             @default("active")
  initiatedAt                      DateTime                           @default(now())
  maturityDate                     DateTime?
  createdAt                        DateTime                           @default(now())
  updatedAt                        DateTime
  gsds_pricing_engine              gsds_pricing_engine[]
  synthetic_derivative_collaterals synthetic_derivative_collaterals[]
  synthetic_derivative_settlements synthetic_derivative_settlements[]

  @@index([derivativeId])
  @@index([derivativeType])
  @@index([party1BankId])
  @@index([party2BankId])
  @@index([status])
}

model synthetic_gru_bonds {
  id                    String                  @id
  syntheticBondId       String                  @unique
  instrumentType        String
  bondId                String?
  underlyingBonds       Json?
  principalAmount       Decimal                 @db.Decimal(32, 8)
  currentPrice          Decimal?                @db.Decimal(32, 12)
  nav                   Decimal?                @db.Decimal(32, 12)
  forwardPrice          Decimal?                @db.Decimal(32, 12)
  swapRate              Decimal?                @db.Decimal(32, 12)
  sovereignBankId       String
  issuerId              String?
  maturityDate          DateTime?
  settlementDate        DateTime?
  status                String                  @default("active")
  issuedAt              DateTime                @default(now())
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  bond_pricing_history  bond_pricing_history[]
  bond_risk_assessments bond_risk_assessments[]
  gru_bond_pricing      gru_bond_pricing[]
  gru_bond_settlements  gru_bond_settlements[]
  gru_bonds             gru_bonds?              @relation(fields: [bondId], references: [bondId])

  @@index([bondId])
  @@index([instrumentType])
  @@index([sovereignBankId])
  @@index([status])
  @@index([syntheticBondId])
}

model synthetic_liquidity_engines {
  id                   String                 @id
  engineId             String                 @unique
  engineType           String
  engineName           String
  description          String
  totalLiquidity       Decimal                @default(0) @db.Decimal(32, 8)
  availableLiquidity   Decimal                @default(0) @db.Decimal(32, 8)
  reservedLiquidity    Decimal                @default(0) @db.Decimal(32, 8)
  commodityVector      Json?
  fxVector             Json?
  temporalVector       Json?
  status               String                 @default("active")
  lastUpdated          DateTime               @default(now())
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  liquidity_operations liquidity_operations[]
  liquidity_tensors    liquidity_tensors[]

  @@index([engineId])
  @@index([engineType])
  @@index([status])
}

model synthetic_settlement_units {
  id                      String                    @id
  ssuId                   String                    @unique
  ssuName                 String
  description             String
  underlyingAssets        Json
  conversionRate          Decimal?                  @db.Decimal(32, 12)
  status                  String                    @default("active")
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  ssu_compositions        ssu_compositions[]
  ssu_redemption_requests ssu_redemption_requests[]
  ssu_transactions        ssu_transactions[]

  @@index([ssuId])
  @@index([status])
}

model system_recommendations {
  id                 String     @id
  recommendationId   String     @unique
  auditId            String
  recommendationType String
  title              String
  description        String
  priority           String
  status             String     @default("pending")
  createdAt          DateTime   @default(now())
  updatedAt          DateTime
  gap_audits         gap_audits @relation(fields: [auditId], references: [id], onDelete: Cascade)

  @@index([auditId])
  @@index([priority])
  @@index([recommendationType])
  @@index([status])
}

model temporal_buffers {
  id                         String                     @id
  bufferId                   String                     @unique
  portalId                   String
  bufferType                 String
  bufferAmount               Decimal                    @db.Decimal(32, 8)
  allocatedAmount            Decimal                    @default(0) @db.Decimal(32, 8)
  status                     String                     @default("active")
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  temporal_liquidity_portals temporal_liquidity_portals @relation(fields: [portalId], references: [id], onDelete: Cascade)

  @@index([bufferId])
  @@index([bufferType])
  @@index([portalId])
}

model temporal_corrections {
  id                 String             @id
  correctionId       String             @unique
  parityId           String
  correctionAmount   Decimal            @db.Decimal(32, 12)
  correctedParity    Decimal            @db.Decimal(32, 12)
  currencyPair       String
  status             String             @default("applied")
  createdAt          DateTime           @default(now())
  updatedAt          DateTime
  temporal_fx_parity temporal_fx_parity @relation(fields: [parityId], references: [id], onDelete: Cascade)

  @@index([correctionId])
  @@index([parityId])
  @@index([status])
}

model temporal_currency_transactions {
  id                      String                  @id
  transactionId           String                  @unique
  tcuId                   String
  sovereignBankId         String
  transactionType         String
  amount                  Decimal                 @db.Decimal(32, 12)
  valueAtTime             Decimal                 @db.Decimal(32, 12)
  timestamp               DateTime                @default(now())
  status                  String                  @default("pending")
  metadata                Json?
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  sovereign_banks         sovereign_banks         @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
  temporal_currency_units temporal_currency_units @relation(fields: [tcuId], references: [id], onDelete: Cascade)

  @@index([sovereignBankId])
  @@index([status])
  @@index([tcuId])
  @@index([timestamp])
  @@index([transactionId])
}

model temporal_currency_units {
  id                             String                           @id
  tcuId                          String                           @unique
  tcuCode                        String                           @unique
  tcuName                        String
  description                    String
  baseCurrency                   String?
  presentValue                   Decimal                          @db.Decimal(32, 12)
  primeTemporalBond              Boolean                          @default(true)
  status                         String                           @default("active")
  createdAt                      DateTime                         @default(now())
  updatedAt                      DateTime
  temporal_currency_transactions temporal_currency_transactions[]
  temporal_projections           temporal_projections[]
  temporal_stability_states      temporal_stability_states[]

  @@index([status])
  @@index([tcuCode])
  @@index([tcuId])
}

model temporal_fx_parity {
  id                   String                 @id
  parityId             String                 @unique
  currencyPair         String
  spotRate             Decimal                @db.Decimal(32, 12)
  temporalSmoothing    Decimal                @db.Decimal(32, 12)
  parallelArbitrage    Decimal                @db.Decimal(32, 12)
  ssuAnchor            Decimal                @db.Decimal(32, 12)
  gqlResonance         Decimal                @db.Decimal(32, 12)
  calculatedParity     Decimal                @db.Decimal(32, 12)
  divergence           Decimal                @db.Decimal(32, 12)
  requiresCorrection   Boolean                @default(false)
  status               String                 @default("calculated")
  createdAt            DateTime               @default(now())
  updatedAt            DateTime
  parity_divergences   parity_divergences[]
  temporal_corrections temporal_corrections[]

  @@index([currencyPair])
  @@index([parityId])
  @@index([requiresCorrection])
  @@index([status])
}

model temporal_integrity_checks {
  id                           String                       @id
  checkId                      String                       @unique
  charterId                    String
  transactionId                String?
  checkType                    String
  checkResult                  String
  checkDetails                 Json?
  contradictionDetected        Boolean                      @default(false)
  resolved                     Boolean                      @default(false)
  resolvedAt                   DateTime?
  createdAt                    DateTime                     @default(now())
  updatedAt                    DateTime
  supra_constitutional_charter supra_constitutional_charter @relation(fields: [charterId], references: [id], onDelete: Cascade)

  @@index([charterId])
  @@index([checkId])
  @@index([checkResult])
  @@index([checkType])
  @@index([transactionId])
}

model temporal_liquidity_portals {
  id                        String                      @id
  portalId                  String                      @unique
  portalName                String
  targetTimeDelta           Int
  confidenceLevel           Decimal                     @db.Decimal(32, 12)
  maxLiquidityBorrow        Decimal                     @db.Decimal(32, 8)
  status                    String                      @default("active")
  activatedAt               DateTime                    @default(now())
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime
  future_liquidity_reserves future_liquidity_reserves[]
  paradox_detections        paradox_detections[]
  temporal_buffers          temporal_buffers[]

  @@index([portalId])
  @@index([status])
}

model temporal_pre_commits {
  id                 String             @id
  preCommitId        String             @unique
  settlementId       String
  predictedState     Json
  sovereignSignature String
  preCommitHash      String
  status             String             @default("pending")
  verifiedAt         DateTime?
  committedAt        DateTime?
  createdAt          DateTime           @default(now())
  updatedAt          DateTime
  chrono_settlements chrono_settlements @relation(fields: [settlementId], references: [id], onDelete: Cascade)

  @@index([preCommitId])
  @@index([settlementId])
  @@index([status])
}

model temporal_projections {
  id                      String                  @id
  projectionId            String                  @unique
  tcuId                   String
  projectionType          String
  timeDelta               Decimal                 @db.Decimal(32, 12)
  projectedValue          Decimal                 @db.Decimal(32, 12)
  economicData            Json?
  confidence              Decimal?                @db.Decimal(32, 12)
  projectedAt             DateTime                @default(now())
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  temporal_currency_units temporal_currency_units @relation(fields: [tcuId], references: [id], onDelete: Cascade)

  @@index([projectedAt])
  @@index([projectionId])
  @@index([projectionType])
  @@index([tcuId])
}

model temporal_reconciliations {
  id                  String             @id
  reconciliationId    String             @unique
  settlementId        String
  delayCost           Decimal            @db.Decimal(32, 12)
  fxDrift             Decimal            @db.Decimal(32, 12)
  commodityShockDelta Decimal            @db.Decimal(32, 12)
  adjustmentAmount    Decimal            @db.Decimal(32, 12)
  reconciliationData  Json
  status              String             @default("pending")
  calculatedAt        DateTime?
  appliedAt           DateTime?
  createdAt           DateTime           @default(now())
  updatedAt           DateTime
  chrono_settlements  chrono_settlements @relation(fields: [settlementId], references: [id], onDelete: Cascade)

  @@index([reconciliationId])
  @@index([settlementId])
  @@index([status])
}

model temporal_reserve_futures {
  id                      String                  @id
  futureId                String                  @unique
  reserveId               String
  futureTime              DateTime
  projectedReserve        Decimal                 @db.Decimal(32, 12)
  confidence              Decimal?                @db.Decimal(32, 12)
  scenario                String?
  projectedAt             DateTime                @default(now())
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  infinite_state_reserves infinite_state_reserves @relation(fields: [reserveId], references: [id], onDelete: Cascade)

  @@index([futureId])
  @@index([futureTime])
  @@index([reserveId])
}

model temporal_settlement_engine {
  id                         String                     @id
  tseId                      String                     @unique
  settlementId               String                     @unique
  futureStateEstimate        Json
  preCommitHash              String
  communicationDelay         Int
  predictiveContract         Json?
  status                     String                     @default("pending")
  committedAt                DateTime?
  verifiedAt                 DateTime?
  createdAt                  DateTime                   @default(now())
  updatedAt                  DateTime
  interplanetary_settlements interplanetary_settlements @relation(fields: [settlementId], references: [id], onDelete: Cascade)

  @@index([preCommitHash])
  @@index([settlementId])
  @@index([status])
  @@index([tseId])
}

model temporal_stability_states {
  id                      String                  @id
  stateId                 String                  @unique
  tcuId                   String
  presentValue            Decimal                 @db.Decimal(32, 12)
  futureWeight            Decimal                 @db.Decimal(32, 12)
  retroFactor             Decimal                 @db.Decimal(32, 12)
  ssuAnchor               Decimal?                @db.Decimal(32, 12)
  calculatedValue         Decimal                 @db.Decimal(32, 12)
  stabilityScore          Decimal?                @db.Decimal(32, 12)
  calculatedAt            DateTime                @default(now())
  createdAt               DateTime                @default(now())
  updatedAt               DateTime
  temporal_currency_units temporal_currency_units @relation(fields: [tcuId], references: [id], onDelete: Cascade)

  @@index([calculatedAt])
  @@index([stateId])
  @@index([tcuId])
}

model threat_mitigations {
  id                      String                   @id
  mitigationId            String                   @unique
  threatId                String?
  incidentId              String?
  mitigationType          String
  action                  String
  affectedEntities        Json?
  status                  String                   @default("pending")
  initiatedAt             DateTime                 @default(now())
  completedAt             DateTime?
  metadata                Json?
  createdAt               DateTime                 @default(now())
  updatedAt               DateTime
  cyber_threat_incidents  cyber_threat_incidents?  @relation(fields: [incidentId], references: [id])
  supra_sovereign_threats supra_sovereign_threats? @relation(fields: [threatId], references: [id])

  @@index([incidentId])
  @@index([mitigationId])
  @@index([mitigationType])
  @@index([status])
  @@index([threatId])
}

model tier_delegations {
  id                                                             String           @id
  delegationId                                                   String           @unique
  fromTierId                                                     String
  toTierId                                                       String
  delegationType                                                 String
  authorityScope                                                 Json
  status                                                         String           @default("active")
  createdAt                                                      DateTime         @default(now())
  updatedAt                                                      DateTime
  governance_tiers_tier_delegations_fromTierIdTogovernance_tiers governance_tiers @relation("tier_delegations_fromTierIdTogovernance_tiers", fields: [fromTierId], references: [id], onDelete: Cascade)
  governance_tiers_tier_delegations_toTierIdTogovernance_tiers   governance_tiers @relation("tier_delegations_toTierIdTogovernance_tiers", fields: [toTierId], references: [id], onDelete: Cascade)

  @@index([delegationId])
  @@index([fromTierId])
  @@index([status])
  @@index([toTierId])
}

model timeline_synchronized_bonds {
  id            String        @id
  syncId        String        @unique
  quantumBondId String
  timelineType  String
  timelineState Json
  syncStatus    String        @default("pending")
  syncedAt      DateTime?
  createdAt     DateTime      @default(now())
  updatedAt     DateTime
  quantum_bonds quantum_bonds @relation(fields: [quantumBondId], references: [id], onDelete: Cascade)

  @@index([quantumBondId])
  @@index([syncId])
  @@index([syncStatus])
  @@index([timelineType])
}

model trans_causal_transactions {
  id                 String               @id
  tcxId              String               @unique
  presentState       Json
  futureProjection   Json
  pastAlignment      Json
  causalHash         String
  integrityWeight    Decimal              @db.Decimal(32, 12)
  causalCoherence    Decimal?             @db.Decimal(32, 12)
  coherenceThreshold Decimal              @default(0.95) @db.Decimal(32, 12)
  status             String               @default("pending")
  deferredReason     String?
  resolutionMapping  Json?
  createdAt          DateTime             @default(now())
  updatedAt          DateTime
  resolvedAt         DateTime?
  causal_resolutions causal_resolutions[]

  @@index([causalCoherence])
  @@index([causalHash])
  @@index([status])
  @@index([tcxId])
}

model udfo_assets {
  id         String   @id
  assetType  String
  code       String   @unique
  name       String
  definition String
  properties Json
  metadata   Json?
  createdAt  DateTime @default(now())
  updatedAt  DateTime

  @@index([assetType])
  @@index([code])
}

model udfo_entities {
  id         String   @id
  entityType String
  identifier String   @unique
  name       String
  definition String
  properties Json
  metadata   Json?
  createdAt  DateTime @default(now())
  updatedAt  DateTime

  @@index([entityType])
  @@index([identifier])
}

model udfo_processes {
  id          String   @id
  processType String
  code        String   @unique
  name        String
  definition  String
  inputs      String[]
  outputs     String[]
  triggers    String[]
  properties  Json
  metadata    Json?
  createdAt   DateTime @default(now())
  updatedAt   DateTime

  @@index([code])
  @@index([processType])
}

model ummc_binding_clauses {
  id                          String                       @id
  clauseId                    String                       @unique
  clauseCode                  String
  clauseName                  String
  description                 String
  pillarId                    String?
  bindingType                 String
  enforcementLevel            String
  status                      String                       @default("active")
  createdAt                   DateTime                     @default(now())
  updatedAt                   DateTime
  ummc_constitutional_pillars ummc_constitutional_pillars? @relation(fields: [pillarId], references: [id])
  ummc_clause_validations     ummc_clause_validations[]

  @@index([clauseCode])
  @@index([clauseId])
  @@index([pillarId])
  @@index([status])
}

model ummc_clause_validations {
  id                   String               @id
  validationId         String               @unique
  clauseId             String
  sovereignBankId      String?
  validationType       String
  validationResult     String
  validationData       Json?
  validatedAt          DateTime?
  createdAt            DateTime             @default(now())
  updatedAt            DateTime
  ummc_binding_clauses ummc_binding_clauses @relation(fields: [clauseId], references: [id], onDelete: Cascade)

  @@index([clauseId])
  @@index([sovereignBankId])
  @@index([validationId])
  @@index([validationResult])
}

model ummc_constitutional_pillars {
  id                      String                    @id
  pillarId                String                    @unique
  pillarNumber            Int
  pillarName              String
  description             String
  status                  String                    @default("active")
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime
  ummc_binding_clauses    ummc_binding_clauses[]
  ummc_sovereign_mappings ummc_sovereign_mappings[]

  @@index([pillarId])
  @@index([pillarNumber])
  @@index([status])
}

model ummc_sovereign_mappings {
  id                          String                       @id
  mappingId                   String                       @unique
  sovereignBankId             String
  realityLayer                String
  identityAnchor              String
  ledgerAnchor                String?
  settlementAnchor            String?
  divergenceBand              Decimal?                     @db.Decimal(32, 12)
  pillarId                    String?
  status                      String                       @default("active")
  createdAt                   DateTime                     @default(now())
  updatedAt                   DateTime
  ummc_constitutional_pillars ummc_constitutional_pillars? @relation(fields: [pillarId], references: [id])
  sovereign_banks             sovereign_banks              @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)

  @@index([mappingId])
  @@index([realityLayer])
  @@index([sovereignBankId])
  @@index([status])
}

model universal_monetary_baselines {
  id                    String                  @id
  umbId                 String                  @unique
  baselineName          String
  description           String
  valuationStandard     Json
  assetTypes            Json
  status                String                  @default("active")
  effectiveDate         DateTime                @default(now())
  deprecatedAt          DateTime?
  createdAt             DateTime                @default(now())
  updatedAt             DateTime
  global_parity_engines global_parity_engines[]

  @@index([status])
  @@index([umbId])
}

model valuation_calculations {
  id                          String                     @id
  valuationId                 String                     @unique
  layerId                     String
  unitId                      String
  assetId                     String?
  classicalValue              Decimal                    @db.Decimal(32, 12)
  quantumExpectedValue        Decimal?                   @db.Decimal(32, 12)
  holographicProjection       Decimal?                   @db.Decimal(32, 12)
  parallelArbitrageAdjustment Decimal?                   @db.Decimal(32, 12)
  totalValue                  Decimal                    @db.Decimal(32, 12)
  calculationFormula          Json
  status                      String                     @default("active")
  calculatedAt                DateTime                   @default(now())
  createdAt                   DateTime                   @default(now())
  updatedAt                   DateTime
  reality_layers              reality_layers             @relation(fields: [layerId], references: [id], onDelete: Cascade)
  multiversal_monetary_units  multiversal_monetary_units @relation(fields: [unitId], references: [id], onDelete: Cascade)

  @@index([assetId])
  @@index([layerId])
  @@index([unitId])
  @@index([valuationId])
}

model valuation_rules {
  id              String    @id
  ruleId          String    @unique
  assetType       String
  valuationMethod String
  feedSource      String?
  updateFrequency String
  status          String    @default("active")
  effectiveDate   DateTime
  expiryDate      DateTime?
  ruleConfig      Json?
  createdAt       DateTime  @default(now())
  updatedAt       DateTime

  @@index([assetType])
  @@index([ruleId])
  @@index([status])
}

model votes {
  id             String         @id
  votingRecordId String
  memberId       String
  vote           String
  votingWeight   Decimal        @db.Decimal(32, 8)
  timestamp      DateTime       @default(now())
  voting_records voting_records @relation(fields: [votingRecordId], references: [id], onDelete: Cascade)

  @@index([memberId])
  @@index([votingRecordId])
}

model voting_records {
  id                String            @id
  governanceBodyId  String
  proposalId        String            @unique
  proposalType      String
  proposalTitle     String
  proposalContent   String
  requiredVoteType  String
  status            String            @default("pending")
  votesFor          Int               @default(0)
  votesAgainst      Int               @default(0)
  votesAbstain      Int               @default(0)
  totalVotingWeight Decimal           @default(0) @db.Decimal(32, 8)
  votingDeadline    DateTime?
  votedAt           DateTime?
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  votes             votes[]
  governance_bodies governance_bodies @relation(fields: [governanceBodyId], references: [id])

  @@index([governanceBodyId])
  @@index([proposalId])
  @@index([status])
}

model wallet_attestation_objects {
  id                String          @id
  waoId             String          @unique
  walletId          String
  deviceAttestation Json
  attestationHash   String
  attestationCycle  Int
  status            String          @default("valid")
  attestedAt        DateTime        @default(now())
  expiresAt         DateTime
  createdAt         DateTime        @default(now())
  updatedAt         DateTime
  quantum_wallets   quantum_wallets @relation(fields: [walletId], references: [id], onDelete: Cascade)

  @@index([attestationCycle])
  @@index([status])
  @@index([walletId])
  @@index([waoId])
}

model wallet_risk_scores {
  id              String          @id
  scoreId         String          @unique
  walletId        String
  riskScore       Decimal         @db.Decimal(32, 8)
  riskFactors     Json?
  calculatedAt    DateTime        @default(now())
  createdAt       DateTime        @default(now())
  updatedAt       DateTime
  quantum_wallets quantum_wallets @relation(fields: [walletId], references: [id], onDelete: Cascade)

  @@index([calculatedAt])
  @@index([scoreId])
  @@index([walletId])
}

model wapl_patterns {
  id                String            @id
  patternCode       String            @unique
  name              String
  description       String
  patternDefinition String
  severity          String
  status            String            @default("ACTIVE")
  createdAt         DateTime          @default(now())
  updatedAt         DateTime
  pattern_matches   pattern_matches[]

  @@index([patternCode])
  @@index([status])
}

model zk_proofs {
  id               String             @id
  proofId          String             @unique
  walletId         String
  proofType        String
  proofData        String
  publicInputs     Json
  verificationKey  String
  status           String             @default("pending")
  verifiedAt       DateTime?
  expiresAt        DateTime?
  createdAt        DateTime           @default(now())
  updatedAt        DateTime
  zk_verifications zk_verifications[]

  @@index([proofId])
  @@index([proofType])
  @@index([status])
  @@index([walletId])
}

model zk_verifications {
  id               String    @id
  verificationId   String    @unique
  proofId          String
  contractId       String?
  verificationType String
  zkbpResult       Boolean?
  zkcpResult       Boolean?
  zkipResult       Boolean?
  overallResult    Boolean
  status           String    @default("pending")
  verifiedAt       DateTime?
  createdAt        DateTime  @default(now())
  updatedAt        DateTime
  zk_proofs        zk_proofs @relation(fields: [proofId], references: [id], onDelete: Cascade)

  @@index([contractId])
  @@index([proofId])
  @@index([status])
  @@index([verificationId])
  @@index([verificationType])
}

// ============================================================================
// IRU (Irrevocable Right of Use) Models
// ============================================================================

model IruOffering {
  id                    String          @id @default(uuid())
  offeringId             String          @unique
  name                  String
  description           String?
  capacityTier          Int              // 1-5: Central Banks, Settlement Banks, Commercial Banks, DFIs, Special Entities
  institutionalType     String          // CentralBank, SettlementBank, CommercialBank, DFI, SpecialEntity
  pricingModel          String          // Fixed, UsageBased, Hybrid
  basePrice             Decimal?        @db.Decimal(32, 2)
  currency              String          @default("USD")
  features              Json?           // Feature list as JSON
  technicalSpecs        Json?           // Technical specifications
  legalFramework        Json?           // Legal framework details
  regulatoryPosition    Json?           // Regulatory positioning
  documents             Json?           // Document references
  status                String          @default("active") // active, inactive, deprecated
  displayOrder          Int             @default(0)
  createdAt             DateTime        @default(now())
  updatedAt             DateTime        @updatedAt
  inquiries             IruInquiry[]
  subscriptions        IruSubscription[]

  @@index([offeringId])
  @@index([capacityTier])
  @@index([institutionalType])
  @@index([status])
}

model IruInquiry {
  id                    String          @id @default(uuid())
  inquiryId             String          @unique
  offeringId            String
  organizationName      String
  institutionalType     String
  jurisdiction          String
  contactEmail          String
  contactPhone          String?
  contactName           String
  estimatedVolume       String?         // Estimated transaction volume
  expectedGoLive        DateTime?       // Expected go-live date
  preliminaryInfo      Json?           // Preliminary information collected
  status                String          @default("submitted") // submitted, acknowledged, in_review, qualified, rejected
  qualificationResult   Json?           // Qualification assessment results
  capacityTier          Int?            // Recommended capacity tier
  riskScore              Decimal?       @db.Decimal(32, 8)
  notes                 String?
  submittedAt           DateTime        @default(now())
  acknowledgedAt        DateTime?
  reviewedAt            DateTime?
  completedAt           DateTime?
  createdAt             DateTime        @default(now())
  updatedAt             DateTime        @updatedAt
  offering              IruOffering    @relation(fields: [offeringId], references: [id], onDelete: Cascade)
  subscription         IruSubscription?

  @@index([inquiryId])
  @@index([offeringId])
  @@index([status])
  @@index([contactEmail])
  @@index([submittedAt])
}

model IruSubscription {
  id                    String          @id @default(uuid())
  subscriptionId        String          @unique
  inquiryId             String?         @unique
  offeringId            String
  participantId         String?        // Link to sovereign bank or participant
  organizationName      String
  capacityTier          Int
  subscriptionStatus    String          @default("pending") // pending, active, suspended, terminated
  iruGrantFee           Decimal?        @db.Decimal(32, 2)
  iruGrantFeePaid       Boolean         @default(false)
  iruGrantFeePaidAt     DateTime?
  subscriptionDate      DateTime        @default(now())
  activationDate        DateTime?
  terminationDate       DateTime?
  paymentMethod         String?         // Payment method used
  paymentReference      String?         // Payment transaction reference
  metadata              Json?           // Additional metadata
  createdAt             DateTime        @default(now())
  updatedAt             DateTime        @updatedAt
  offering              IruOffering    @relation(fields: [offeringId], references: [id], onDelete: Cascade)
  inquiry               IruInquiry?     @relation(fields: [inquiryId], references: [id], onDelete: SetNull)
  agreements            IruAgreement[]
  deployments           IruDeployment[]

  @@index([subscriptionId])
  @@index([offeringId])
  @@index([participantId])
  @@index([subscriptionStatus])
  @@index([subscriptionDate])
  @@index([inquiryId])
}

model IruAgreement {
  id                    String          @id @default(uuid())
  agreementId           String          @unique
  subscriptionId       String
  agreementType         String          @default("IRU_PARTICIPATION") // IRU_PARTICIPATION, AMENDMENT, etc.
  agreementVersion       String          @default("1.0")
  templateUsed          String?         // Template identifier
  agreementContent      String          @db.Text // Full agreement text
  variables             Json?           // Variables substituted in template
  status                String          @default("draft") // draft, pending_signature, signed, executed, terminated
  dbisSignatory         String?         // DBIS signatory name
  participantSignatory  String?         // Participant signatory name
  dbisSignedAt          DateTime?
  participantSignedAt   DateTime?
  executedAt            DateTime?
  esignatureProvider    String?         // DocuSign, HelloSign, etc.
  esignatureEnvelopeId  String?         // E-signature envelope ID
  esignatureStatus      String?         // E-signature status
  documentUrl           String?         // URL to signed document
  documentHash          String?         // Hash of signed document
  subscription          IruSubscription @relation(fields: [subscriptionId], references: [id], onDelete: Cascade)

  @@index([agreementId])
  @@index([subscriptionId])
  @@index([status])
}

model IruDeployment {
  id                    String          @id @default(uuid())
  deploymentId          String          @unique
  subscriptionId        String
  status                String          @default("pending") // pending, provisioning, deploying, configuring, testing, active, failed, cancelled
  progress              Int             @default(0) // 0-100
  stages                Json?           // Deployment stages with status
  containers            Json?           // Container deployment details
  estimatedCompletion   DateTime?
  metadata              Json?           // Additional deployment metadata
  error                 String?         // Error message if failed
  startedAt             DateTime        @default(now())
  completedAt           DateTime?
  createdAt             DateTime        @default(now())
  updatedAt             DateTime        @updatedAt
  subscription          IruSubscription @relation(fields: [subscriptionId], references: [id], onDelete: Cascade)

  @@index([deploymentId])
  @@index([subscriptionId])
  @@index([status])
  @@index([startedAt])
}

model IruIPAMPool {
  id                    String                @id @default(uuid())
  poolId                String                @unique
  name                  String
  subnet                String
  gateway               String
  startRange            String
  endRange              String
  vlan                  Int?
  status                String                @default("active") // active, inactive
  createdAt             DateTime              @default(now())
  updatedAt             DateTime              @updatedAt
  allocations           IruNetworkAllocation[]

  @@index([poolId])
  @@index([status])
}

model IruNetworkAllocation {
  id                    String                @id @default(uuid())
  allocationId          String                @unique
  subscriptionId        String
  poolId                String
  vmid                  Int
  ipAddress             String
  gateway               String
  subnet                String
  vlan                  Int?
  status                String                @default("allocated") // allocated, released
  allocatedAt           DateTime              @default(now())
  releasedAt            DateTime?
  createdAt             DateTime              @default(now())
  updatedAt             DateTime              @updatedAt
  pool                  IruIPAMPool          @relation(fields: [poolId], references: [id], onDelete: Cascade)

  @@index([allocationId])
  @@index([subscriptionId])
  @@index([poolId])
  @@index([vmid])
  @@index([ipAddress])
  @@index([status])
}

model IruJurisdictionalLaw {
  id                    String                @id @default(uuid())
  jurisdiction          String
  lawName               String
  lawType               String                // banking, securities, payment, data_protection, sanctions, other
  requirements          Json                  // Array of requirements
  restrictions          Json                  // Array of restrictions
  complianceNotes       String?               @db.Text
  status                String                @default("active") // active, inactive, deprecated
  lastUpdated           DateTime              @default(now())
  createdAt             DateTime              @default(now())
  updatedAt             DateTime              @updatedAt

  @@unique([jurisdiction, lawName])
  @@index([jurisdiction])
  @@index([lawType])
  @@index([status])
}

// ============================================
// SolaceNet Capability Platform Models
// ============================================

model solacenet_capability {
  id              String                      @id @default(uuid())
  capabilityId    String                      @unique // Human-readable ID (e.g., "payment-gateway")
  name            String
  version         String                      @default("1.0.0")
  description     String?                      @db.Text
  ownerTeam       String?
  dependencies    Json                        @default("[]") // Array of capability IDs
  configSchema    Json?                       // JSON schema for capability configuration
  defaultState    String                      @default("disabled") // disabled, pilot, enabled, suspended, drain
  status          String                      @default("active") // active, deprecated, archived
  metadata        Json?                       // Additional metadata
  createdAt       DateTime                    @default(now())
  updatedAt       DateTime                    @updatedAt

  // Relations
  bindings        solacenet_capability_binding[]
  dependenciesAs  solacenet_capability_dependency[] @relation("Dependent")
  dependenciesOf  solacenet_capability_dependency[] @relation("Dependency")
  entitlements    solacenet_entitlement[]
  policyRules     solacenet_policy_rule[]
  auditLogs       solacenet_toggle_audit_log[]

  @@index([capabilityId])
  @@index([status])
  @@index([defaultState])
  @@index([ownerTeam])
}

model solacenet_capability_binding {
  id            String                  @id @default(uuid())
  capabilityId  String
  providerId    String?                 // Reference to provider connector
  region        String                   // Region code (e.g., "US", "EU", "APAC")
  config        Json?                    // Provider-specific configuration
  secretsRef    String?                  // Reference to secrets manager key
  status        String                   @default("active") // active, inactive
  createdAt     DateTime                 @default(now())
  updatedAt     DateTime                 @updatedAt

  // Relations
  capability    solacenet_capability     @relation(fields: [capabilityId], references: [capabilityId], onDelete: Cascade)
  provider      solacenet_provider_connector? @relation(fields: [providerId], references: [id], onDelete: SetNull)

  @@unique([capabilityId, region])
  @@index([capabilityId])
  @@index([providerId])
  @@index([region])
  @@index([status])
}

model solacenet_capability_dependency {
  id                String                  @id @default(uuid())
  dependentId       String                  // Capability that depends on another
  dependencyId      String                  // Capability that is depended upon
  dependencyType    String                  @default("required") // required, optional, recommended
  createdAt         DateTime                @default(now())
  updatedAt         DateTime                @updatedAt

  // Relations
  dependent         solacenet_capability     @relation("Dependent", fields: [dependentId], references: [capabilityId], onDelete: Cascade)
  dependency        solacenet_capability     @relation("Dependency", fields: [dependencyId], references: [capabilityId], onDelete: Cascade)

  @@unique([dependentId, dependencyId])
  @@index([dependentId])
  @@index([dependencyId])
  @@index([dependencyType])
}

model solacenet_entitlement {
  id              String                  @id @default(uuid())
  tenantId         String
  programId        String?                 // Optional program/product line
  capabilityId    String
  region           String?                 // Optional region scoping
  channel          String?                 // Optional channel (API, UI, mobile)
  stateOverride    String?                 // Override default state: disabled, pilot, enabled, suspended, drain
  allowlist        Json                    @default("[]") // Array of user/client IDs for pilot mode
  effectiveFrom   DateTime                @default(now())
  effectiveTo      DateTime?
  metadata         Json?
  createdAt        DateTime                @default(now())
  updatedAt        DateTime                @updatedAt

  // Relations
  capability       solacenet_capability     @relation(fields: [capabilityId], references: [capabilityId], onDelete: Cascade)

  @@unique([tenantId, programId, capabilityId, region, channel])
  @@index([tenantId])
  @@index([programId])
  @@index([capabilityId])
  @@index([region])
  @@index([channel])
  @@index([effectiveFrom])
  @@index([effectiveTo])
}

model solacenet_policy_rule {
  id            String                  @id @default(uuid())
  ruleId        String                  @unique
  capabilityId  String
  scope         String                  // tenant, program, region, channel, global
  scopeValue    String?                 // Specific value for scope (e.g., tenant ID, region code)
  condition     Json                    // JSON expression for evaluation
  decision      String                  // allow, deny, limit
  limits        Json?                   // Limits if decision is "limit"
  reason         String?                 @db.Text
  ticket         String?                 // Reference to ticket/change request
  priority      Int                     @default(100) // Lower = higher priority
  status         String                  @default("active") // active, inactive
  metadata       Json?
  createdAt      DateTime                @default(now())
  updatedAt      DateTime                @updatedAt

  // Relations
  capability     solacenet_capability     @relation(fields: [capabilityId], references: [capabilityId], onDelete: Cascade)

  @@index([ruleId])
  @@index([capabilityId])
  @@index([scope, scopeValue])
  @@index([status])
  @@index([priority])
}

model solacenet_toggle_audit_log {
  id            String                  @id @default(uuid())
  actor         String                  // User ID or service name
  action        String                  // enabled, disabled, suspended, drain, kill_switch
  capabilityId  String
  beforeState   String?                 // Previous state
  afterState    String                  // New state
  scope         Json?                   // Tenant/program/region/channel context
  reason        String?                 @db.Text
  ticket        String?                 // Reference to ticket/change request
  metadata      Json?
  timestamp     DateTime                @default(now())

  // Relations
  capability    solacenet_capability     @relation(fields: [capabilityId], references: [capabilityId], onDelete: Cascade)

  @@index([id])
  @@index([actor])
  @@index([action])
  @@index([capabilityId])
  @@index([timestamp])
  @@index([beforeState, afterState])
}

model solacenet_provider_connector {
  id              String                      @id @default(uuid())
  connectorId     String                      @unique // Human-readable ID (e.g., "stripe", "m-pesa")
  name            String
  providerType    String                      // payment-processor, mobile-money, fx-provider, etc.
  region          String?                     // Supported region(s)
  configSchema    Json?                       // JSON schema for connector configuration
  secretsSchema   Json?                       // JSON schema for required secrets
  status          String                      @default("active") // active, inactive, deprecated
  metadata        Json?
  createdAt       DateTime                    @default(now())
  updatedAt       DateTime                    @updatedAt

  // Relations
  bindings        solacenet_capability_binding[]

  @@index([connectorId])
  @@index([providerType])
  @@index([region])
  @@index([status])
}

// ------------------------------------------------------------
// Gateway Microservices Tables
// ------------------------------------------------------------

model gateway_instructions {
  id              String   @id @default(uuid())
  txnId           String   @unique
  instructionType String   // PaymentInstruction, SecuritiesDeliveryInstruction, etc.
  canonicalData   Json
  status          String   // RECEIVED, VALIDATED, SENT, SETTLED_FINAL, etc.
  railStatus      Json?    // Rail-specific status
  correlationId   String
  createdAt       DateTime @default(now())
  updatedAt       DateTime @updatedAt

  @@index([txnId])
  @@index([status])
  @@index([correlationId])
}

model gateway_inbox {
  id            String   @id @default(uuid())
  fingerprint   String   @unique // Hash of message
  railMsgId     String?
  rail          String
  rawPayload    String?  @db.Text
  canonicalData Json?
  status        String   // ACCEPTED, DUPLICATE, REJECTED
  createdAt     DateTime @default(now())

  @@index([fingerprint])
  @@index([railMsgId])
  @@index([rail])
}

model gateway_outbox {
  id           String   @id @default(uuid())
  txnId        String
  adapterId    String
  payloadHash  String
  sendAttempts Int      @default(0)
  lastAttemptAt DateTime?
  status       String   // PENDING, SENT, FAILED
  createdAt    DateTime @default(now())
  updatedAt    DateTime @updatedAt

  @@index([txnId])
  @@index([status])
  @@index([adapterId])
}

model gateway_correlation {
  id              String   @id @default(uuid())
  txnId           String
  internalId      String
  railId          String?
  messageRef      String?
  statementLineId String?
  confidence      String   // HIGH, MEDIUM, LOW
  evidence        Json?
  createdAt       DateTime @default(now())
  updatedAt       DateTime @updatedAt

  @@index([txnId])
  @@index([internalId])
  @@index([railId])
}

model gateway_evidence {
  id             String   @id @default(uuid())
  txnId          String
  evidenceBundle Json
  hashManifest   String
  signature      String?
  sealedAt       DateTime @default(now())

  @@index([txnId])
  @@index([hashManifest])
}

model gateway_finality {
  id             String   @id @default(uuid())
  txnId          String
  rail           String
  finalityStatus String   // PROVISIONAL, FINAL, IRREVERSIBLE
  finalityRule   String   // Rule version used
  declaredAt     DateTime @default(now())

  @@index([txnId])
  @@index([rail])
  @@index([finalityStatus])
}

model dual_ledger_outbox {
  id                   String   @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  outboxId             String   @unique @map("outbox_id")

  internalEntryId      String   @map("internal_entry_id")
  internalSettlementId String?  @map("internal_settlement_id")

  sovereignBankId      String   @map("sovereign_bank_id")
  ledgerId             String   @map("ledger_id")

  referenceId          String   @map("reference_id")
  payload              Json     @map("payload")
  payloadHash          String   @map("payload_hash")

  status               String   @default("QUEUED")
  scbTransactionId     String?  @map("scb_transaction_id")
  scbLedgerHash        String?  @map("scb_ledger_hash")
  scbSignature         String?  @map("scb_signature")

  attempts             Int      @default(0)
  lastAttemptAt         DateTime? @map("last_attempt_at")
  lastError             String?   @map("last_error")
  ackedAt               DateTime? @map("acked_at")
  finalizedAt           DateTime? @map("finalized_at")

  createdAt             DateTime  @default(now()) @map("created_at")
  updatedAt             DateTime  @updatedAt @map("updated_at")

  @@map("dual_ledger_outbox")
  @@index([status])
  @@index([sovereignBankId])
  @@index([referenceId])
  @@index([payloadHash])
  @@unique([sovereignBankId, referenceId])
}

// ============================================================================
// AS4 Settlement Models
// ============================================================================

model As4Member {
  id                    String   @id @default(uuid())
  memberId              String   @unique
  organizationName      String
  as4EndpointUrl        String
  tlsCertFingerprint    String
  allowedMessageTypes   String[]
  cutoffWindows         Json?
  routingGroups         String[]
  status                String   @default("active")
  capacityTier           Int?
  createdAt             DateTime @default(now())
  updatedAt             DateTime @updatedAt
  certificates          As4MemberCertificate[]
  instructions          As4SettlementInstruction[]

  @@index([memberId])
  @@index([status])
  @@index([capacityTier])
  @@map("as4_member")
}

model As4MemberCertificate {
  id                    String   @id @default(uuid())
  memberId              String
  certificateType       String   // TLS, SIGNING, ENCRYPTION
  fingerprint           String
  certificateData       String?  // Optional: full certificate (encrypted)
  validFrom             DateTime
  validTo               DateTime
  status                String   @default("active") // active, expired, revoked
  revokedAt             DateTime?
  createdAt             DateTime @default(now())
  updatedAt             DateTime @updatedAt
  member                As4Member @relation(fields: [memberId], references: [memberId], onDelete: Cascade)

  @@index([memberId])
  @@index([fingerprint])
  @@index([status])
  @@index([validTo])
  @@map("as4_member_certificate")
}

model As4SettlementInstruction {
  id                    String   @id @default(uuid())
  instructionId         String   @unique
  messageId             String
  fromMemberId          String
  toMemberId            String
  correlationId         String
  businessType          String   // DBIS.SI.202, etc.
  valueDate             DateTime
  currency              String
  amount                Decimal  @db.Decimal(32, 8)
  debtorAccount         String
  creditorAccount       String
  status                String   // RECEIVED, ACCEPTED, QUEUED, POSTED_FINAL, REJECTED
  postingId             String?
  finalityStatus        String?
  payloadHash            String
  signatureEvidence      Json?
  as4ReceiptEvidence     Json?
  compliancePackageRef   String?
  rejectReason           String?
  createdAt             DateTime @default(now())
  updatedAt             DateTime @updatedAt
  member                 As4Member @relation(fields: [fromMemberId], references: [memberId])
  advices                As4Advice[]
  payloadVaults          As4PayloadVault[]

  @@index([instructionId])
  @@index([messageId])
  @@index([fromMemberId])
  @@index([toMemberId])
  @@index([correlationId])
  @@index([status])
  @@index([valueDate])
  @@unique([fromMemberId, instructionId])
  @@map("as4_settlement_instruction")
}

model As4Advice {
  id                    String   @id @default(uuid())
  adviceId              String   @unique
  instructionId         String
  adviceType            String   // DBIS.AD.900, DBIS.AD.910
  postedAt              DateTime
  postingId             String
  creditedAccount       String?
  debitedAccount        String?
  currency              String
  amount                Decimal  @db.Decimal(32, 8)
  balanceAfter          Decimal? @db.Decimal(32, 8)
  finalityStatus        String
  createdAt             DateTime @default(now())
  instruction           As4SettlementInstruction @relation(fields: [instructionId], references: [id], onDelete: Cascade)

  @@index([adviceId])
  @@index([instructionId])
  @@index([postingId])
  @@index([adviceType])
  @@map("as4_advice")
}

model As4PayloadVault {
  id                    String   @id @default(uuid())
  vaultId               String   @unique
  instructionId         String?
  messageId             String
  payloadHash            String
  payloadData            String   // Encrypted payload
  payloadType           String   // INSTRUCTION, ADVICE, RECEIPT
  memberId              String
  createdAt             DateTime @default(now())
  instruction           As4SettlementInstruction? @relation(fields: [instructionId], references: [id], onDelete: SetNull)

  @@index([vaultId])
  @@index([instructionId])
  @@index([messageId])
  @@index([payloadHash])
  @@index([memberId])
  @@unique([instructionId, payloadType])
  @@map("as4_payload_vault")
}

model As4ReplayNonce {
  id                    String   @id @default(uuid())
  nonce                 String   @unique
  memberId              String
  messageId             String
  usedAt                DateTime @default(now())
  expiresAt             DateTime

  @@index([nonce])
  @@index([memberId])
  @@index([expiresAt])
  @@map("as4_replay_nonce")
}
