// 거래처기준 Config
const customerMasterConfig = {
  id: 'customer',
  title: '거래처 목록',
  description: '거래처 템플릿과 필드를 관리합니다',
  icon: 'Users',
  tabs: [
    { id: 'hierarchy', label: '계층구조', icon: 'GitBranch' },
    { id: 'section', label: '섹션', icon: 'Layers' },
    { id: 'field', label: '항목', icon: 'ClipboardList' },
    { id: 'attribute', label: '속성', icon: 'Settings' },
  ],
  entityTypes: [
    { id: 1, code: 'SALES', name: '매출', description: '제품 판매처 (고객사)', sortOrder: 1, isActive: true },
    { id: 2, code: 'PURCHASE', name: '매입', description: '자재/외주 구매처', sortOrder: 2, isActive: true },
    { id: 3, code: 'BOTH', name: '매입매출', description: '양방향 거래처', sortOrder: 3, isActive: true },
  ],
  // 매입 거래처 하위분류
  supplyTypes: [
    { id: 1, code: 'MATERIAL', name: '자재', description: '자재 공급업체', sortOrder: 1, isActive: true },
    { id: 2, code: 'OUTSOURCING', name: '외주', description: '외주 협력사', sortOrder: 2, isActive: true },
  ],
  categories: [
    { id: 1, code: 'DOM', name: '국내', parentId: null, level: 1, path: '/1', sortOrder: 1 },
    { id: 2, code: 'DOM-LG', name: '대기업', parentId: 1, level: 2, path: '/1/2', sortOrder: 1 },
    { id: 3, code: 'DOM-SM', name: '중소기업', parentId: 1, level: 2, path: '/1/3', sortOrder: 2 },
    { id: 4, code: 'OVS', name: '해외', parentId: null, level: 1, path: '/4', sortOrder: 2 },
    { id: 5, code: 'OVS-ASIA', name: '아시아', parentId: 4, level: 2, path: '/4/5', sortOrder: 1 },
    { id: 6, code: 'OVS-EUR', name: '유럽', parentId: 4, level: 2, path: '/4/6', sortOrder: 2 },
  ],
  masterFields: [
    { id: 1, fieldKey: 'customerCode', fieldName: '거래처코드', inputType: 'text', isRequired: true, validations: { maxLength: 20 }, description: '거래처 식별 코드' },
    { id: 2, fieldKey: 'customerName', fieldName: '거래처명', inputType: 'text', isRequired: true, validations: { maxLength: 100 }, description: '거래처 이름' },
    { id: 3, fieldKey: 'customerType', fieldName: '거래처유형', inputType: 'select', isRequired: true, options: { items: ['매출', '매입', '매입매출'] }, description: '거래처 유형' },
    { id: 13, fieldKey: 'supplyType', fieldName: '매입구분', inputType: 'select', isRequired: false, options: { items: ['자재', '외주'] }, description: '매입 거래처 하위분류 (매입 유형일 때만 표시)', condition: { customerType: '매입' } },
    { id: 4, fieldKey: 'businessNo', fieldName: '사업자번호', inputType: 'text', isRequired: false, validations: { pattern: '^[0-9]{10}$' }, description: '사업자등록번호' },
    { id: 5, fieldKey: 'ceoName', fieldName: '대표자명', inputType: 'text', isRequired: false, description: '대표자 이름' },
    { id: 6, fieldKey: 'address', fieldName: '주소', inputType: 'text', isRequired: false, description: '사업장 주소' },
    { id: 7, fieldKey: 'phone', fieldName: '전화번호', inputType: 'text', isRequired: false, description: '대표 전화번호' },
    { id: 8, fieldKey: 'email', fieldName: '이메일', inputType: 'text', isRequired: false, description: '대표 이메일' },
    { id: 9, fieldKey: 'creditGrade', fieldName: '신용등급', inputType: 'select', isRequired: false, options: { items: ['A', 'B', 'C', 'D'] }, description: '거래처 신용등급' },
    { id: 10, fieldKey: 'paymentTerm', fieldName: '결제조건', inputType: 'select', isRequired: false, options: { items: ['현금', '30일', '60일', '90일'] }, description: '결제 조건' },
    { id: 11, fieldKey: 'contactPerson', fieldName: '담당자', inputType: 'text', isRequired: false, description: '담당자 이름' },
    { id: 12, fieldKey: 'contactPhone', fieldName: '담당자연락처', inputType: 'text', isRequired: false, description: '담당자 연락처' },
  ],
  masterSections: [
    { id: 1, sectionKey: 'basicInfo', sectionName: '기본정보', sectionType: 'general', applicableTypes: ['SALES', 'PURCHASE', 'BOTH'], description: '거래처 기본 정보', fields: [1, 2, 3, 13, 4, 5] },
    { id: 2, sectionKey: 'contactInfo', sectionName: '연락처정보', sectionType: 'general', applicableTypes: ['SALES', 'PURCHASE', 'BOTH'], description: '연락처 정보', fields: [6, 7, 8] },
    { id: 3, sectionKey: 'tradeInfo', sectionName: '거래정보', sectionType: 'general', applicableTypes: ['SALES', 'PURCHASE', 'BOTH'], description: '거래 조건 정보', fields: [9, 10] },
    { id: 4, sectionKey: 'managerInfo', sectionName: '담당자정보', sectionType: 'general', applicableTypes: ['SALES', 'PURCHASE', 'BOTH'], description: '담당자 정보', fields: [11, 12] },
  ],
  pageTemplates: [
    {
      id: 1, pageCode: 'customer_registration', pageName: '거래처 등록', pagePath: '/기준정보/거래처_등록', itemTypes: ['CUST'],
      sections: [
        { sectionId: 1, sectionKey: 'basicInfo', sectionName: '기본정보', sortOrder: 1, fields: [
          { fieldId: 1, fieldKey: 'customerCode', fieldName: '거래처코드', inputType: 'text', isRequired: true },
          { fieldId: 2, fieldKey: 'customerName', fieldName: '거래처명', inputType: 'text', isRequired: true },
        ]},
      ],
      conditions: []
    }
  ],

  // ============ 등록된 거래처 샘플 데이터 ============
  sampleCustomers: [
    // 매출 거래처 (판매처)
    {
      id: 1,
      customerCode: 'CUS-001',
      customerName: '삼성물산(주)',
      customerType: '매출',
      category: 'DOM-LG',
      businessNo: '1248100998',
      ceoName: '오세철',
      address: '서울특별시 서초구 서초대로 74길 11',
      phone: '02-2145-2114',
      email: 'procurement@samsung.com',
      creditGrade: 'A',
      paymentTerm: '60일',
      contactPerson: '김건설',
      contactPhone: '010-1234-5678',
      isActive: true,
      createdAt: '2024-01-10',
    },
    {
      id: 2,
      customerCode: 'CUS-002',
      customerName: '현대건설(주)',
      customerType: '매출',
      category: 'DOM-LG',
      businessNo: '1018116756',
      ceoName: '윤영준',
      address: '서울특별시 종로구 율곡로 75',
      phone: '02-746-1114',
      email: 'order@hdec.kr',
      creditGrade: 'A',
      paymentTerm: '60일',
      contactPerson: '이현장',
      contactPhone: '010-2345-6789',
      isActive: true,
      createdAt: '2024-01-10',
    },
    {
      id: 3,
      customerCode: 'CUS-003',
      customerName: '대우건설(주)',
      customerType: '매출',
      category: 'DOM-LG',
      businessNo: '1168108831',
      ceoName: '백정완',
      address: '서울특별시 중구 을지로 170',
      phone: '02-2109-3114',
      email: 'purchase@dwconst.co.kr',
      creditGrade: 'A',
      paymentTerm: '30일',
      contactPerson: '박건설',
      contactPhone: '010-3456-7890',
      isActive: true,
      createdAt: '2024-01-15',
    },
    {
      id: 4,
      customerCode: 'CUS-004',
      customerName: '(주)서울인테리어',
      customerType: '매출',
      category: 'DOM-SM',
      businessNo: '2148556789',
      ceoName: '정서울',
      address: '서울특별시 강남구 테헤란로 123',
      phone: '02-555-1234',
      email: 'order@seoulinterior.co.kr',
      creditGrade: 'B',
      paymentTerm: '30일',
      contactPerson: '김담당',
      contactPhone: '010-4567-8901',
      isActive: true,
      createdAt: '2024-02-01',
    },
    // 매입 거래처 - 자재 (자재공급업체)
    {
      id: 5,
      customerCode: 'SUP-001',
      customerName: '(주)한국스크린',
      customerType: '매입',
      supplyType: '자재',
      category: 'DOM-SM',
      businessNo: '3148109876',
      ceoName: '이원단',
      address: '경기도 안산시 단원구 산업로 200',
      phone: '031-481-5500',
      email: 'sales@koreascreen.co.kr',
      creditGrade: 'A',
      paymentTerm: '30일',
      contactPerson: '최판매',
      contactPhone: '010-5678-9012',
      supplyItems: ['스크린 원단', '방화스크린'],
      isActive: true,
      createdAt: '2024-01-05',
    },
    {
      id: 6,
      customerCode: 'SUP-002',
      customerName: '(주)대한슬랫',
      customerType: '매입',
      supplyType: '자재',
      category: 'DOM-SM',
      businessNo: '4168205432',
      ceoName: '박슬랫',
      address: '경기도 화성시 정남면 공단로 50',
      phone: '031-357-3000',
      email: 'order@dhslat.co.kr',
      creditGrade: 'A',
      paymentTerm: '30일',
      contactPerson: '정자재',
      contactPhone: '010-6789-0123',
      supplyItems: ['슬랫 코일', '알루미늄 슬랫'],
      isActive: true,
      createdAt: '2024-01-05',
    },
    {
      id: 7,
      customerCode: 'SUP-003',
      customerName: '(주)세종철강',
      customerType: '매입',
      supplyType: '자재',
      category: 'DOM-SM',
      businessNo: '5148306543',
      ceoName: '김철강',
      address: '충청남도 당진시 송악읍 철강로 100',
      phone: '041-360-1000',
      email: 'supply@sejongsteel.co.kr',
      creditGrade: 'B',
      paymentTerm: '현금',
      contactPerson: '이철판',
      contactPhone: '010-7890-1234',
      supplyItems: ['철판', '아연도금강판'],
      isActive: true,
      createdAt: '2024-01-10',
    },
    // 매입 거래처 - 외주 (외주협력사)
    {
      id: 8,
      customerCode: 'PAR-001',
      customerName: '(주)금성도금',
      customerType: '매입',
      supplyType: '외주',
      category: 'DOM-SM',
      businessNo: '6158407654',
      ceoName: '최도금',
      address: '경기도 시흥시 정왕동 공단로 88',
      phone: '031-498-7700',
      email: 'work@ksplating.co.kr',
      creditGrade: 'B',
      paymentTerm: '30일',
      contactPerson: '박협력',
      contactPhone: '010-8901-2345',
      partnerType: '도금가공',
      isActive: true,
      createdAt: '2024-01-20',
    },
  ],
};

export default customerMasterConfig;
