// ==========================================
// INTERFACES - CONTRACT
// ==========================================

import type { Address } from './common'
import type { DocumentType, ContractReviewStatus, ContractStatus } from './enums'

export interface ContractParty {
  role: 'CONTROLLER' | 'PROCESSOR' | 'PARTY'
  name: string
  address?: Address
  signatoryName?: string
  signatoryRole?: string
}

export interface ContractDocument {
  id: string
  tenantId: string
  vendorId: string

  // Dokument
  fileName: string
  originalName: string
  mimeType: string
  fileSize: number
  storagePath: string // MinIO path

  // Klassifikation
  documentType: DocumentType

  // Versioning
  version: string
  previousVersionId?: string

  // Metadaten (extrahiert)
  parties?: ContractParty[]
  effectiveDate?: Date
  expirationDate?: Date
  autoRenewal?: boolean
  renewalNoticePeriod?: number // Tage
  terminationNoticePeriod?: number // Tage

  // Review Status
  reviewStatus: ContractReviewStatus
  reviewCompletedAt?: Date
  complianceScore?: number // 0-100

  // Workflow
  status: ContractStatus
  signedAt?: Date

  // Extracted text for search
  extractedText?: string
  pageCount?: number

  createdAt: Date
  updatedAt: Date
}

export interface DocumentVersion {
  id: string
  documentId: string
  version: string
  storagePath: string
  extractedText?: string
  pageCount: number
  createdAt: Date
}
