import * as XLSX from 'xlsx';

const hwTabs = ['개인PC', '서버', '스토리지', '전산비품'];
const swTabs = ['구독SW', '영구SW'];

const hwHeaders = ['법인', '자산코드', '명칭', '위치', '관리자', 'IP주소', 'MACaddress', 'HW사양', 'OS'];
const swHeaders = ['법인', 'SW명', '라이선스키', '할당자', '사용기간', '비고'];

const wb = XLSX.utils.book_new();

hwTabs.forEach((tab, i) => {
  const wsData = [hwHeaders, [`(주)회사${i}`, `ASSET-${i}00`, `${tab} 모델A`, '본사 1층', '관리자A', '192.168.0.1', '00:00:00:00:00:01', 'Core i7, 16GB RAM', 'Windows 10']];
  const ws = XLSX.utils.aoa_to_sheet(wsData);
  XLSX.utils.book_append_sheet(wb, ws, tab);
});

swTabs.forEach((tab, i) => {
  const wsData = [swHeaders, [`(주)회사${i}`, `${tab} Adobe CC`, '1234-5678-ABCD', '홍길동,김철수', '2024.01~2024.12', '본사 전용']];
  const ws = XLSX.utils.aoa_to_sheet(wsData);
  XLSX.utils.book_append_sheet(wb, ws, tab);
});

XLSX.writeFile(wb, 'temp_db.xlsx');
console.log('temp_db.xlsx created!');
