/**
 * T2 — control-plane record types. The frozen §4.2/§4.5 shapes are RE-EXPORTED from
 * relay-contracts, never redefined locally (INDEX §2 rule 1).
 *
 * OQ1 RESOLUTION: `AccountRecord`/`SessionRecord`/`PairingCodeRecord` were promoted into
 * relay-contracts (`model/account.ts`, `pairing/enroll.ts`), so this module re-exports them
 * instead of mirroring the SQL locally. The only P3-local additions are the INV8 companion
 * status-version ROW types (OQ6 — pending INDEX promotion of the `*_status_versions` tables).
 */
export type {
  AccountRecord,
  AccountStatus,
  SessionRecord,
  HostRecord,
  HostStatus,
  PlanTier,
  RouteEntry,
} from 'relay-contracts'
export type { PairingCodeRecord, EnrollResult } from 'relay-contracts'

import type { AccountStatus, HostStatus } from 'relay-contracts'

/** Append-only companion row for `accounts.status` versioning (INV8, OQ6). */
export interface AccountStatusVersionRow {
  readonly accountId: string
  readonly version: number
  readonly status: AccountStatus
  readonly changedAt: string
  readonly changedBy: string
}

/** Append-only companion row for `hosts.status`/`revoked_at` versioning (INV8, OQ6). */
export interface HostStatusVersionRow {
  readonly hostId: string
  readonly version: number
  readonly status: HostStatus
  readonly revokedAt: string | null
  readonly changedAt: string
  readonly changedBy: string
}

/** Immutable metering sample row (append-only, INV8). */
export interface MeteringSampleRow {
  readonly hostId: string
  readonly accountId: string
  readonly nodeId: string
  readonly concurrentViewers: number
  readonly sampledAt: string
}
