/**
 * 출고관리 Mock 데이터
 */

import type {
  ShipmentItem,
  ShipmentDetail,
  ShipmentStats,
  ShipmentFilterTab,
  LotOption,
  LogisticsOption,
  VehicleTonnageOption,
  VehicleDispatch,
  ProductGroup,
  ProductPart,
} from './types';

// 통계 데이터
export const mockStats: ShipmentStats = {
  todayShipmentCount: 3,
  scheduledCount: 5,
  shippingCount: 1,
  urgentCount: 4,
  totalCount: 20,
};

// 필터 탭
export const mockFilterTabs: ShipmentFilterTab[] = [
  { key: 'all', label: '전체', count: 20 },
  { key: 'scheduled', label: '출고예정', count: 5 },
  { key: 'ready', label: '출고대기', count: 1 },
  { key: 'shipping', label: '배송중', count: 1 },
  { key: 'completed', label: '배송완료', count: 12 },
  { key: 'calendar', label: '출고일정', count: 0 },
];

// 출고 목록 Mock 데이터
export const mockShipmentItems: ShipmentItem[] = [
  {
    id: 'sl-251220-01',
    shipmentNo: 'SL-251220-01',
    lotNo: 'KD-TS-251217-10',
    scheduledDate: '2025-12-20',
    status: 'completed',
    priority: 'urgent',
    deliveryMethod: 'direct',
    customerName: '두산건설(주)',
    siteName: '위브 청라',
    manager: '-',
    canShip: true,
    depositConfirmed: true,
    invoiceIssued: true,
  },
  {
    id: 'sl-251222-03',
    shipmentNo: 'SL-251222-03',
    lotNo: 'KD-TS-251217-09',
    scheduledDate: '2025-12-22',
    status: 'completed',
    priority: 'normal',
    deliveryMethod: 'logistics',
    customerName: '태영건설(주)',
    siteName: '대시앙 동탄',
    manager: '-',
    canShip: true,
    depositConfirmed: true,
    invoiceIssued: true,
  },
  {
    id: 'sl-251224-01',
    shipmentNo: 'SL-251224-01',
    lotNo: 'KD-TS-251217-08',
    scheduledDate: '2025-12-24',
    status: 'completed',
    priority: 'normal',
    deliveryMethod: 'logistics',
    customerName: '호반건설(주)',
    siteName: '버킷 광교',
    manager: '-',
    canShip: true,
    depositConfirmed: true,
    invoiceIssued: true,
  },
  {
    id: 'sl-251221-03',
    shipmentNo: 'SL-251221-03',
    lotNo: 'KD-TS-251217-06',
    scheduledDate: '2025-12-21',
    status: 'shipping',
    priority: 'normal',
    deliveryMethod: 'pickup',
    customerName: '호반건설(주)',
    siteName: '버킷 광교',
    manager: '-',
    canShip: true,
    depositConfirmed: true,
    invoiceIssued: true,
  },
  {
    id: 'sl-251223-02',
    shipmentNo: 'SL-251223-02',
    lotNo: 'KD-TS-251217-05',
    scheduledDate: '2025-12-23',
    status: 'ready',
    priority: 'normal',
    deliveryMethod: 'direct',
    customerName: '포스코건설(주)',
    siteName: '더샵 송도',
    manager: '-',
    canShip: true,
    depositConfirmed: true,
    invoiceIssued: true,
  },
  {
    id: 'sl-251222-02',
    shipmentNo: 'SL-251222-02',
    lotNo: 'KD-TS-251217-04',
    scheduledDate: '2025-12-22',
    status: 'completed',
    priority: 'normal',
    deliveryMethod: 'direct',
    customerName: 'GS건설(주)',
    siteName: '자이 위례',
    manager: '-',
    canShip: true,
    depositConfirmed: true,
    invoiceIssued: true,
  },
  {
    id: 'sl-251222-01',
    shipmentNo: 'SL-251222-01',
    lotNo: 'KD-TS-251217-03',
    scheduledDate: '2025-12-22',
    status: 'completed',
    priority: 'normal',
    deliveryMethod: 'pickup',
    customerName: '대우건설(주)',
    siteName: '푸르지오 일산',
    manager: '-',
    canShip: true,
    depositConfirmed: true,
    invoiceIssued: true,
  },
  {
    id: 'sl-251223-02b',
    shipmentNo: 'SL-251223-02',
    lotNo: 'KD-TS-251217-02',
    scheduledDate: '2025-12-23',
    status: 'scheduled',
    priority: 'normal',
    deliveryMethod: 'logistics',
    customerName: '현대건설(주)',
    siteName: '힐스테이트 판교',
    manager: '-',
    canShip: false,
    depositConfirmed: false,
    invoiceIssued: false,
  },
  {
    id: 'sl-251221-02',
    shipmentNo: 'SL-251221-02',
    lotNo: 'KD-TS-251217-02',
    scheduledDate: '2025-12-23',
    status: 'scheduled',
    priority: 'normal',
    deliveryMethod: 'pickup',
    customerName: '현대건설(주)',
    siteName: '힐스테이트 판교',
    manager: '-',
    canShip: false,
    depositConfirmed: true,
    invoiceIssued: false,
  },
  {
    id: 'sl-251221-01',
    shipmentNo: 'SL-251221-01',
    lotNo: 'KD-TS-251217-01',
    scheduledDate: '2025-12-21',
    status: 'scheduled',
    priority: 'normal',
    deliveryMethod: 'pickup',
    customerName: '삼성물산(주)',
    siteName: '래미안 강남 포레스트',
    manager: '-',
    canShip: false,
    depositConfirmed: false,
    invoiceIssued: false,
  },
];

// 배차 정보 Mock 데이터
export const mockVehicleDispatches: VehicleDispatch[] = [
  {
    id: 'vd-1',
    logisticsCompany: '한진물류',
    arrivalDateTime: '2025-12-20 09:00',
    tonnage: '3.5톤',
    vehicleNo: '34사 5678',
    driverContact: '010-5656-7878',
    remarks: '1차 배차',
  },
  {
    id: 'vd-2',
    logisticsCompany: 'CJ대한통운',
    arrivalDateTime: '2025-12-20 14:00',
    tonnage: '5톤',
    vehicleNo: '56나 1234',
    driverContact: '010-1234-5678',
    remarks: '2차 배차',
  },
];

// 제품 그룹 Mock 데이터
export const mockProductGroups: ProductGroup[] = [
  {
    id: 'pg-1',
    productName: '스크린 셔터 (와이어)',
    specification: '3200 x 2500 mm',
    partCount: 5,
    parts: [
      { id: 'pp-1-1', seq: 1, itemName: '와이어 드럼', specification: '320mm', quantity: 2, unit: 'EA' },
      { id: 'pp-1-2', seq: 2, itemName: '가이드 레일 (좌)', specification: '2500mm', quantity: 2, unit: 'EA' },
      { id: 'pp-1-3', seq: 3, itemName: '가이드 레일 (우)', specification: '2500mm', quantity: 2, unit: 'EA' },
      { id: 'pp-1-4', seq: 4, itemName: '구동 모터', specification: '220V / 60Hz', quantity: 1, unit: 'EA' },
      { id: 'pp-1-5', seq: 5, itemName: '하부 프레임', specification: '3200mm', quantity: 1, unit: 'EA' },
    ],
  },
  {
    id: 'pg-2',
    productName: '롤스크린 (전동)',
    specification: '2800 x 2200 mm',
    partCount: 4,
    parts: [
      { id: 'pp-2-1', seq: 1, itemName: '롤 튜브', specification: '2800mm', quantity: 1, unit: 'EA' },
      { id: 'pp-2-2', seq: 2, itemName: '원단 스크린', specification: '2800x2200', quantity: 1, unit: 'EA' },
      { id: 'pp-2-3', seq: 3, itemName: '구동 모터', specification: '220V / 60Hz', quantity: 1, unit: 'EA' },
      { id: 'pp-2-4', seq: 4, itemName: '사이드 브라켓', specification: '좌/우 세트', quantity: 2, unit: 'SET' },
    ],
  },
  {
    id: 'pg-3',
    productName: '버티컬 블라인드',
    specification: '2400 x 2100 mm',
    partCount: 3,
    parts: [
      { id: 'pp-3-1', seq: 1, itemName: '헤드레일', specification: '2400mm', quantity: 1, unit: 'EA' },
      { id: 'pp-3-2', seq: 2, itemName: '루버 (패브릭)', specification: '89mm x 2100mm', quantity: 27, unit: 'EA' },
      { id: 'pp-3-3', seq: 3, itemName: '바텀 체인', specification: '2400mm', quantity: 1, unit: 'EA' },
    ],
  },
  {
    id: 'pg-4',
    productName: '허니콤 블라인드 (더블)',
    specification: '1800 x 2000 mm',
    partCount: 4,
    parts: [
      { id: 'pp-4-1', seq: 1, itemName: '상부 레일', specification: '1800mm', quantity: 1, unit: 'EA' },
      { id: 'pp-4-2', seq: 2, itemName: '하부 레일', specification: '1800mm', quantity: 1, unit: 'EA' },
      { id: 'pp-4-3', seq: 3, itemName: '허니콤 원단 (채광)', specification: '1800x1000mm', quantity: 1, unit: 'EA' },
      { id: 'pp-4-4', seq: 4, itemName: '허니콤 원단 (암막)', specification: '1800x1000mm', quantity: 1, unit: 'EA' },
    ],
  },
  {
    id: 'pg-5',
    productName: '방충망 (플리세)',
    specification: '2000 x 2200 mm',
    partCount: 3,
    parts: [
      { id: 'pp-5-1', seq: 1, itemName: '플리세 망', specification: '2000x2200mm', quantity: 1, unit: 'EA' },
      { id: 'pp-5-2', seq: 2, itemName: '프레임 (알루미늄)', specification: '2000x2200mm', quantity: 1, unit: 'SET' },
      { id: 'pp-5-3', seq: 3, itemName: '손잡이', specification: '-', quantity: 2, unit: 'EA' },
    ],
  },
];

// 기타부품 Mock 데이터
export const mockOtherParts: ProductPart[] = [
  { id: 'op-1', seq: 1, itemName: '리모컨 (16채널)', specification: '-', quantity: 5, unit: 'EA' },
  { id: 'op-2', seq: 2, itemName: '설치 브라켓 (벽면용)', specification: '100mm', quantity: 10, unit: 'EA' },
  { id: 'op-3', seq: 3, itemName: '설치 브라켓 (천장용)', specification: '80mm', quantity: 8, unit: 'EA' },
  { id: 'op-4', seq: 4, itemName: '전원 어댑터', specification: 'DC 24V', quantity: 5, unit: 'EA' },
  { id: 'op-5', seq: 5, itemName: '연결 케이블', specification: '3m', quantity: 10, unit: 'EA' },
  { id: 'op-6', seq: 6, itemName: '고정 나사 세트', specification: 'M4 x 30mm', quantity: 20, unit: 'SET' },
];

// 출고 상세 Mock 데이터
export const mockShipmentDetail: ShipmentDetail = {
  id: 'sl-251220-01',
  shipmentNo: 'SL-251220-01',
  lotNo: 'KD-TS-251217-10',
  scheduledDate: '2025-12-20',
  shipmentDate: '2025-12-20',
  status: 'completed',
  priority: 'urgent',
  deliveryMethod: 'direct',
  freightCost: 'prepaid',
  freightCostLabel: '선불',
  depositConfirmed: true,
  invoiceIssued: true,
  customerGrade: 'B등급',
  canShip: true,
  loadingManager: '김상차',
  loadingCompleted: '2025.12.20.',
  registrant: '판매1팀 임판매',

  customerName: '두산건설(주)',
  siteName: '위브 청라',
  deliveryAddress: '인천시 서구 청라동 456',
  receiver: '임현장',
  receiverContact: '010-8901-2345',
  zipCode: '22751',
  address: '인천시 서구 청라동 456',
  addressDetail: '위브 청라 현장사무소',

  // 배차 정보 (다중 행)
  vehicleDispatches: mockVehicleDispatches,

  // 제품내용 (그룹핑)
  productGroups: mockProductGroups,
  otherParts: mockOtherParts,

  products: [
    {
      id: 'prod-1',
      no: 1,
      itemCode: 'SH3225',
      itemName: '스크린 셔터 (와이어)',
      floorUnit: '18층/M-01',
      specification: '3200×2500',
      quantity: 1,
      lotNo: 'LOT-20251217-001',
    },
  ],

  logisticsCompany: '-',
  vehicleTonnage: '3.5톤',
  shippingCost: undefined,

  vehicleNo: '34사 5678',
  driverName: '정운전',
  driverContact: '010-5656-7878',

  remarks: '[통합테스트10] 두산건설 - 전체 플로우 완료 (견적→수주→생산→품질→출고→회계)',
};

// LOT 선택 옵션 (등록 시)
export const mockLotOptions: LotOption[] = [
  {
    value: 'KD-TS-251217-10',
    label: 'KD-TS-251217-10',
    customerName: '두산건설(주)',
    siteName: '위브 청라',
    deliveryAddress: '인천시 서구 청라동 456',
  },
  {
    value: 'KD-TS-251217-09',
    label: 'KD-TS-251217-09',
    customerName: '태영건설(주)',
    siteName: '대시앙 동탄',
    deliveryAddress: '경기도 화성시 동탄순환대로 100',
  },
  {
    value: 'KD-TS-251217-08',
    label: 'KD-TS-251217-08',
    customerName: '호반건설(주)',
    siteName: '버킷 광교',
    deliveryAddress: '경기도 수원시 영통구 광교로 200',
  },
];

// 물류사 옵션
export const mockLogisticsOptions: LogisticsOption[] = [
  { value: 'hanjin', label: '한진물류' },
  { value: 'cj', label: 'CJ대한통운' },
  { value: 'lotte', label: '롯데글로벌로지스' },
  { value: 'hyundai', label: '현대글로비스' },
];

// 차량 톤수 옵션
export const mockVehicleTonnageOptions: VehicleTonnageOption[] = [
  { value: '1t', label: '1톤' },
  { value: '2.5t', label: '2.5톤' },
  { value: '3.5t', label: '3.5톤' },
  { value: '5t', label: '5톤' },
  { value: '11t', label: '11톤' },
  { value: '25t', label: '25톤' },
];

// 우선순위 옵션
export const priorityOptions = [
  { value: 'urgent', label: '긴급' },
  { value: 'normal', label: '보통' },
  { value: 'low', label: '낮음' },
];

// 배송방식 옵션
export const deliveryMethodOptions = [
  { value: 'pickup', label: '상차' },
  { value: 'direct', label: '직접배차' },
  { value: 'logistics', label: '물류사' },
];