import type { KbxComponentCatalogEntry } from '@kbx/contracts'

const commonInputStates = [
  { id:'default', label:'기본', state:'default' as const },
  { id:'required', label:'필수', state:'required' as const },
  { id:'readonly', label:'읽기전용', state:'readonly' as const },
  { id:'disabled', label:'사용불가', state:'disabled' as const },
  { id:'changed', label:'변경됨', state:'changed' as const },
  { id:'warning', label:'주의', state:'warning' as const },
  { id:'ai-suggested', label:'AI 제안', state:'ai-suggested' as const },
  { id:'error', label:'오류', state:'error' as const },
  { id:'keyboard', label:'키보드', state:'keyboard' as const },
]

export const kbxComponentCatalog: KbxComponentCatalogEntry[] = [
  { component:'KbxInput', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxNumberField', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxMoneyField', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxQuantityField', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxDateField', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxDateRange', group:'input', scenarios:[...commonInputStates.slice(0,4),{id:'keyboard',label:'키보드',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxSelect', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxLookup', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxButton', group:'command', scenarios:[{id:'default',label:'기본',state:'default'},{id:'disabled',label:'사용불가',state:'disabled'},{id:'loading',label:'처리중',state:'loading'},{id:'keyboard',label:'단축키',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxCommandBar', group:'command', scenarios:[{id:'default',label:'기본',state:'default'},{id:'keyboard',label:'F3/F8',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxSearchPanel', group:'command', scenarios:[{id:'default',label:'기본 조회조건',state:'default'},{id:'safe-preference',label:'기본/마지막 조건·민감검색어 제외',state:'default'},{id:'keyboard',label:'F3/Enter',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxPageHeader', group:'template', scenarios:[{id:'default',label:'화면명/경로/Utility',state:'default'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxFormSection', group:'template', scenarios:[{id:'default',label:'기본정보',state:'default'},{id:'description',label:'설명/보조 Action',state:'default'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxFormGrid', group:'template', scenarios:[{id:'two-column',label:'Desktop 2-column',state:'default',density:'compact'},{id:'narrow',label:'좁은 화면 1-column',state:'default'}], accessibility:{keyboard:false,focusVisible:false} },
  { component:'KbxFormSpan', group:'template', scenarios:[{id:'full',label:'주소/비고 Full span',state:'default'}], accessibility:{keyboard:false,focusVisible:false} },
  { component:'KbxBulkActionBar', group:'command', scenarios:[{id:'default',label:'17건 선택',state:'default'},{id:'disabled',label:'조건 불충족',state:'disabled'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxIntegrationState', group:'feedback', scenarios:[{id:'queued',label:'전송 대기',state:'default'},{id:'retrying',label:'자동 재시도',state:'loading'},{id:'delivered',label:'전송 완료',state:'default'},{id:'failed',label:'연계 실패',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxDataProvenance', group:'feedback', scenarios:[{id:'fresh',label:'최신',state:'default'},{id:'stale',label:'Stale',state:'loading'},{id:'expired',label:'만료',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxStatus', group:'feedback', scenarios:[{id:'default',label:'상태 의미',state:'default'}], accessibility:{keyboard:false,focusVisible:false,colorIndependentStatus:true} },
  { component:'KbxToast', group:'feedback', scenarios:[{id:'default',label:'성공',state:'default'},{id:'error',label:'주의',state:'error'}], accessibility:{keyboard:false,focusVisible:false,colorIndependentStatus:true} },
  { component:'KbxConfirm', group:'overlay', scenarios:[{id:'default',label:'위험 확인',state:'default'},{id:'keyboard',label:'Esc/Primary',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxDialog', group:'overlay', scenarios:[{id:'default',label:'기본',state:'default'},{id:'keyboard',label:'Esc/Focus Trap',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxDrawer', group:'overlay', scenarios:[{id:'default',label:'상세',state:'default'},{id:'keyboard',label:'Esc/Focus Restore',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxDataGrid', group:'grid', scenarios:[{id:'default',label:'Compact',state:'default',density:'compact'},{id:'loading',label:'조회 중',state:'loading'},{id:'empty',label:'결과 없음',state:'empty'},{id:'keyboard',label:'Keyboard/F2',state:'keyboard'},{id:'fast-entry',label:'Paste/Fill Down/행복제',state:'keyboard'},{id:'all-filtered',label:'검색결과 전체선택',state:'default'},{id:'changed',label:'Changed Cell',state:'changed'},{id:'error',label:'Cell/API Error 이동',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxExcelMenu', group:'command', scenarios:[{id:'default',label:'다운로드/업로드 메뉴',state:'default'},{id:'keyboard',label:'키보드 이동',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxExcelImport', group:'template', scenarios:[{id:'default',label:'파일',state:'default'},{id:'error',label:'검증 오류',state:'error'},{id:'loading',label:'반영중',state:'loading'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxJobProgress', group:'feedback', scenarios:[{id:'default',label:'진행중',state:'default'},{id:'loading',label:'장시간 처리',state:'loading'},{id:'error',label:'부분실패',state:'error'}], accessibility:{keyboard:false,focusVisible:false,colorIndependentStatus:true} },
  { component:'KbxOperationCenter', group:'feedback', scenarios:[{id:'default',label:'진행/최근 작업',state:'default'},{id:'target-focus',label:'Home 대상 작업 Focus',state:'keyboard'},{id:'error',label:'실패/부분완료',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxNotificationCenter', group:'feedback', scenarios:[{id:'default',label:'운영 알림',state:'default'},{id:'target-focus',label:'Home 대상 알림 Focus',state:'keyboard'},{id:'error',label:'중요 알림',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxAuditTrail', group:'feedback', scenarios:[{id:'default',label:'변경이력',state:'default'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxHelpPanel', group:'overlay', scenarios:[{id:'default',label:'화면 도움말',state:'default'},{id:'keyboard',label:'Esc/Focus',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxAiPanel', group:'overlay', scenarios:[{id:'default',label:'AI 보조',state:'default'},{id:'loading',label:'답변 준비',state:'loading'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxProposalPanel', group:'overlay', scenarios:[{id:'default',label:'AI 변경안 검토',state:'default'},{id:'error',label:'검증 실패',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxListPage', group:'template', scenarios:[{id:'default',label:'Search/List',state:'default',density:'compact'},{id:'empty-recovery',label:'Empty → 조회조건 초기화',state:'empty'},{id:'command-problem',label:'Bulk 업무 오류 인라인 복구',state:'error'},{id:'keyboard',label:'F3',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxMasterPage', group:'template', scenarios:[{id:'default',label:'Master CRUD',state:'default',density:'compact'},{id:'command-problem',label:'저장/상태변경 Problem',state:'error'},{id:'keyboard',label:'F8',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxTransactionPage', group:'template', scenarios:[{id:'default',label:'Desktop Compact',state:'default',density:'compact'},{id:'command-problem',label:'Save/Confirm Problem',state:'error'},{id:'keyboard',label:'F2/F8',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxMasterDetailPage', group:'template', scenarios:[{id:'default',label:'Master/Detail',state:'default',density:'compact'},{id:'context',label:'선택 Context + 이력',state:'default',density:'compact'},{id:'command-problem',label:'업무 Action 실패 복구',state:'error'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxQueuePage', group:'template', scenarios:[{id:'default',label:'Work Queue',state:'default',density:'compact'},{id:'command-problem',label:'배정/해결 실패 복구',state:'error'},{id:'query-recovery',label:'업무별 조회 오류·Empty 복구',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxReconcilePage', group:'template', scenarios:[{id:'default',label:'Reconcile',state:'default',density:'compact'},{id:'error',label:'불일치',state:'error'},{id:'command-problem',label:'해결업무 실패 복구',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxWmsMobilePage', group:'wms', scenarios:[{id:'default',label:'Touch',state:'default',density:'touch'},{id:'error',label:'현장 조회 오류·재시도',state:'error',density:'touch'},{id:'keyboard',label:'Scanner',state:'keyboard'},{id:'blocked-production',label:'실행 API 미연결·입력 차단',state:'error',density:'touch'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxApplicationShell', group:'shell', scenarios:[{id:'default',label:'Desktop',state:'default',density:'compact'},{id:'module',label:'Header↔SideNav 모듈 동기화',state:'default'},{id:'runtime-center',label:'작업/알림 비모달 Panel·Focus 복구',state:'default'},{id:'keyboard',label:'메뉴검색',state:'keyboard'},{id:'overflow',label:'우선 항목 Overflow·전체 건수',state:'default'},{id:'attention-expand',label:'숨은 우선항목 전체 보기·접기',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxWorkspaceTabs', group:'shell', scenarios:[{id:'default',label:'다중 업무 Tab',state:'default',density:'compact'},{id:'dirty',label:'미저장 표시',state:'warning'},{id:'pinned',label:'고정 업무',state:'default'},{id:'resume',label:'세션 복원·Home Roving Focus',state:'keyboard'},{id:'overflow',label:'10개 초과 더보기',state:'default'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxCheckbox', group:'input', scenarios:[{id:'default',label:'기본',state:'default'},{id:'disabled',label:'사용불가',state:'disabled'},{id:'readonly',label:'읽기전용',state:'readonly'}], accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxRadio', group:'input', scenarios:[{id:'default',label:'기본',state:'default'},{id:'disabled',label:'사용불가',state:'disabled'}], accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxTextarea', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxTabs', group:'template', scenarios:[{id:'default',label:'상세 Tabs',state:'default'},{id:'keyboard',label:'Keyboard',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxBadge', group:'feedback', scenarios:[{id:'default',label:'상태 보조',state:'default'},{id:'error',label:'오류',state:'error'}], accessibility:{keyboard:false,focusVisible:false,colorIndependentStatus:true} },
  { component:'KbxTooltip', group:'feedback', scenarios:[{id:'default',label:'Hover',state:'default'},{id:'keyboard',label:'Focus',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxBarcodeField', group:'input', scenarios:commonInputStates, accessibility:{keyboard:true,focusVisible:true,labelRequired:true} },
  { component:'KbxSectionHeader', group:'template', scenarios:[{id:'default',label:'Detail Section',state:'default'}], accessibility:{keyboard:true,focusVisible:true} },
  { component:'KbxQuickFilterBar', group:'command', scenarios:[{id:'default',label:'KPI Quick Filter',state:'default'},{id:'error',label:'예외 Filter',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxProblemFeedback', group:'feedback', scenarios:[{id:'validation',label:'검증 오류 요약',state:'error'},{id:'business-rule',label:'업무 규칙 + 허용 Action',state:'warning'},{id:'permission',label:'권한 거부',state:'error'},{id:'integration-retry',label:'외부연계 재시도',state:'error'},{id:'system-reference',label:'시스템 오류 + 참조번호',state:'error'},{id:'secure-action',label:'Server Action allow-list',state:'disabled'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxDataState', group:'feedback', scenarios:[{id:'idle',label:'조회 전',state:'idle'},{id:'loading',label:'조회 중',state:'loading'},{id:'empty',label:'결과 없음',state:'empty'},{id:'error',label:'복구 가능 오류',state:'error'},{id:'forced-colors',label:'OS 고대비',state:'default'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxTemplateStateBoundary', group:'feedback', scenarios:[{id:'idle',label:'조회 전',state:'idle'},{id:'ready',label:'정상',state:'ready'},{id:'refreshing',label:'재조회 중 Context 유지',state:'refreshing'},{id:'empty-recovery',label:'Empty 복구 Action',state:'empty'},{id:'error-retry',label:'재시도 가능한 오류',state:'error'},{id:'error-no-retry',label:'재시도 불가 오류',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxSummaryBar', group:'feedback', scenarios:[{id:'default',label:'조회/선택/합계',state:'default'}], accessibility:{keyboard:false,focusVisible:false} },
  { component:'KbxHomePage', group:'shell', scenarios:[{id:'default',label:'업무 Workbench Home',state:'default',density:'compact'},{id:'attention',label:'실패 작업·중요 알림 우선',state:'error'},{id:'dirty-first',label:'미저장 업무 우선',state:'warning'},{id:'resume',label:'이전 세션 업무 위치 복원',state:'default'},{id:'keyboard',label:'메뉴검색',state:'keyboard'},{id:'overflow',label:'우선 항목 Overflow·전체 건수',state:'default'},{id:'attention-expand',label:'숨은 우선항목 전체 보기·접기',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxAccessDenied', group:'shell', scenarios:[{id:'error',label:'권한 없음',state:'error'},{id:'secure-default',label:'화면 정보 비노출',state:'default'},{id:'recovery',label:'홈/메뉴검색 복구',state:'default'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxRouteNotFound', group:'shell', scenarios:[{id:'recovery',label:'잘못된 딥링크 복구',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxTemplateContextBar', group:'template', scenarios:[{id:'default',label:'조회/선택/기준시각 문맥',state:'default'},{id:'error',label:'오류 문맥',state:'error'}], accessibility:{keyboard:false,focusVisible:false,colorIndependentStatus:true} },
  { component:'KbxProgressSteps', group:'template', scenarios:[{id:'default',label:'단계 진행',state:'default'}], accessibility:{keyboard:false,focusVisible:false,colorIndependentStatus:true} },
  { component:'KbxLookupDialog', group:'overlay', scenarios:[{id:'default',label:'검색/선택',state:'default'},{id:'loading',label:'조회 중',state:'loading'},{id:'empty',label:'결과 없음',state:'empty'},{id:'error',label:'조회 실패/재시도',state:'error'},{id:'keyboard',label:'↑↓/Enter/Esc',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true,labelRequired:true,colorIndependentStatus:true} },
  { component:'KbxValidationSummary', group:'feedback', scenarios:[{id:'error',label:'입력 오류 요약',state:'error'},{id:'keyboard',label:'오류 위치 이동',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxExceptionSummary', group:'feedback', scenarios:[{id:'default',label:'예외 카운터',state:'default'},{id:'error',label:'중요 예외',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxExceptionDetailDrawer', group:'overlay', scenarios:[{id:'default',label:'원인/대상/후속작업',state:'default'},{id:'error',label:'Critical 예외',state:'error'},{id:'disabled',label:'권한 없는 Action',state:'disabled'},{id:'keyboard',label:'Drawer Focus/Esc',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxRecordLifecycle', group:'feedback', scenarios:[{id:'default',label:'Workflow/Version/Audit',state:'default'},{id:'changed',label:'Dirty',state:'changed'},{id:'error',label:'Conflict',state:'error'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxRecordNavigator', group:'navigation', scenarios:[{id:'default',label:'목록 3 / 24 이전·다음',state:'default'},{id:'boundary',label:'첫/마지막 레코드',state:'disabled'},{id:'dirty',label:'미저장 이동 차단',state:'disabled'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxBarcodeCapture', group:'wms', scenarios:[{id:'default',label:'Keyboard Wedge',state:'default',density:'touch'},{id:'disabled',label:'Scan Paused',state:'disabled',density:'touch'},{id:'keyboard',label:'Enter 종결/중복 Debounce',state:'keyboard',density:'touch'},{id:'error',label:'Oversized/Invalid 입력 무시',state:'error',density:'touch'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxNetworkIndicator', group:'wms', scenarios:[{id:'default',label:'온라인',state:'default',density:'touch'},{id:'loading',label:'동기화/전송 대기',state:'loading',density:'touch'},{id:'error',label:'오프라인',state:'error',density:'touch'}], accessibility:{keyboard:false,focusVisible:false,colorIndependentStatus:true} },
  { component:'KbxWmsActionButton', group:'wms', scenarios:[{id:'default',label:'Touch CTA',state:'default',density:'touch'},{id:'disabled',label:'사용불가',state:'disabled',density:'touch'},{id:'loading',label:'처리중',state:'loading',density:'touch'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxAiAssistant', group:'overlay', scenarios:[{id:'default',label:'현재 업무 질문',state:'default'},{id:'loading',label:'답변 준비',state:'loading'},{id:'error',label:'조회 실패/재질문',state:'error'},{id:'disabled',label:'Capability/Permission Guard',state:'disabled'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
  { component:'KbxUtilityRail', group:'overlay', scenarios:[{id:'default',label:'Help/AI/제안',state:'default'},{id:'error',label:'AI 오류 복구',state:'error'},{id:'keyboard',label:'Panel Focus/Esc',state:'keyboard'}], accessibility:{keyboard:true,focusVisible:true,colorIndependentStatus:true} },
]
