// tdd-guard:skip — Konstanten + Typen (die testbare isoWeek-Logik liegt in lib/oee/iso-week.ts).
// Pure constants, types, and helpers extracted from oee-calculator.tsx.
// No React, no side effects — safe to import from server or client.
import { currentIsoWeek } from '@/lib/oee/iso-week'

export interface FormState {
  supplierId: string
  projectId: string
  plantName: string
  lineName: string
  machineName: string
  calendarWeek: number
  year: number
  productName: string
  daysPerWeek: number
  hoursPerDay: number
  shiftsPerDay: number
  plannedBreakMin: number
  plannedDowntimeMin: number
  unplannedDowntimeMin: number
  setupMin: number
  maintenanceMin: number
  otherLossMin: number
  taktMode: 'ideal' | 'optimum'
  idealCycleTimeSec: string
  optimumTaktTimeSec: string
  producedOutput: string
  goodOutput: string
  scrapOutput: string
  reworkOutput: string
  installedCapacity: string
  purchasedCapacity: string
  notes: string
}

// KAR-704/O6: currentIsoWeek lebt jetzt zentral in lib/oee/iso-week.ts —
// hier importiert (für INITIAL_FORM) + re-exportiert (bestehende Importeure).
export { currentIsoWeek }

const now = new Date()

export const INITIAL_FORM: FormState = {
  supplierId: '', projectId: '', plantName: '', lineName: '', machineName: '',
  calendarWeek: currentIsoWeek(), year: now.getFullYear(), productName: '',
  daysPerWeek: 5, hoursPerDay: 8, shiftsPerDay: 1,
  plannedBreakMin: 0, plannedDowntimeMin: 0, unplannedDowntimeMin: 0,
  setupMin: 0, maintenanceMin: 0, otherLossMin: 0,
  taktMode: 'ideal', idealCycleTimeSec: '', optimumTaktTimeSec: '',
  producedOutput: '', goodOutput: '', scrapOutput: '', reworkOutput: '',
  installedCapacity: '', purchasedCapacity: '', notes: '',
}

export const EXAMPLE_FORM: FormState = {
  supplierId: '', projectId: '',
  plantName: 'Beispielwerk München', lineName: 'Montagelinie 1', machineName: '',
  calendarWeek: currentIsoWeek(), year: now.getFullYear(),
  productName: 'Bauteil XY-300',
  daysPerWeek: 5, hoursPerDay: 8, shiftsPerDay: 2,
  plannedBreakMin: 60, plannedDowntimeMin: 30, unplannedDowntimeMin: 45,
  setupMin: 20, maintenanceMin: 0, otherLossMin: 0,
  taktMode: 'ideal', idealCycleTimeSec: '60', optimumTaktTimeSec: '',
  producedOutput: '750', goodOutput: '720', scrapOutput: '', reworkOutput: '',
  installedCapacity: '960', purchasedCapacity: '800', notes: '',
}

export const INPUT_CLS = 'w-full h-10 px-3 rounded-lg border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary'
export const READONLY_CLS = 'w-full h-10 px-3 rounded-lg border border-border bg-muted text-sm text-muted-foreground flex items-center'
export const LABEL_CLS = 'block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1.5'
export const CARD_CLS = 'bg-card rounded-xl border border-border'
