import { defineKbxScreen } from '@kbx/ui'
import { kbxImportField, type KbxImportDefinition } from '@kbx/contracts'

export const orderImportScreen = defineKbxScreen({
  id: 'OMS-ORD-003',
  version: '1.2.0',
  module: 'OMS',
  type: 'import', templateCode:'T08',
  title: '주문 Excel 업로드',
  helpKey: 'OMS-ORD-003',
  permissions: ['oms.order.import'],
  commands: [],
  telemetry: { enabled: true },
})

export const orderImportDefinition: KbxImportDefinition = {
  id: 'oms.orders.v1',
  screenId: 'OMS-ORD-003',
  entity: 'order',
  title: '주문 Excel 업로드',
  allowCreate: true,
  allowUpdate: true,
  maxFileSizeBytes: 20 * 1024 * 1024,
  maxRows: 100_000,
  fields: [
    kbxImportField('orderNo'),
    kbxImportField('orderDate'),
    kbxImportField('customerCode'),
    kbxImportField('warehouseCode'),
    kbxImportField('receiverName'),
    kbxImportField('phone'),
    kbxImportField('postalCode'),
    kbxImportField('address1'),
    kbxImportField('address2'),
    kbxImportField('itemCode'),
    kbxImportField('orderQty'),
    kbxImportField('unitPrice'),
    kbxImportField('remark'),
  ],
}
