import { SidebarMenuItem } from '@/components/molecules/SidebarMenu';

export const MAIN_DRAWER_LINKS: SidebarMenuItem[] = [
  {
    text: 'Dashboard',
    link: '/dashboard',
    icon: 'heroicons-outline:chart-bar-square',
    permission: ['lti.dashboard.list'],
  },
  {
    text: 'Daily Checklist',
    link: '/daily-checklist',
    icon: 'heroicons-outline:clipboard-check',
    permission: [
      'lti.daily_checklist.dashboard.list',
      'lti.daily_checklist.create',
      'lti.daily_checklist.list',
      'lti.daily_checklist.detail',
      'lti.daily_checklist.reports',
      'lti.daily_checklist.master_data.employee',
      'lti.daily_checklist.master_data.activity',
      'lti.daily_checklist.master_data.configuration',
      'lti.daily_checklist.master_data.kandang',
    ],
    submenu: [
      {
        text: 'Dashboard',
        link: '/daily-checklist/dashboard',
        icon: 'lucide:layout-dashboard',
        permission: ['lti.daily_checklist.dashboard.list'],
      },
      {
        text: 'Formulir',
        link: '/daily-checklist/daily-checklist',
        icon: 'lucide:clipboard-check',
        permission: ['lti.daily_checklist.create'],
      },
      {
        text: 'Daftar Daily Checklist',
        link: '/daily-checklist/list-daily-checklist',
        icon: 'lucide:circle-check',
        permission: ['lti.daily_checklist.list'],
      },
      {
        text: 'Laporan',
        link: '/daily-checklist/reports',
        icon: 'lucide:file-text',
        permission: ['lti.daily_checklist.reports'],
      },
      {
        text: 'Master Data',
        link: '/daily-checklist/master-data',
        icon: 'lucide:database',
        permission: [
          'lti.daily_checklist.master_data.employee',
          'lti.daily_checklist.master_data.activity',
          'lti.daily_checklist.master_data.configuration',
        ],
        submenu: [
          {
            text: 'Employee (ABK)',
            link: '/daily-checklist/master-data/employee',
            permission: ['lti.daily_checklist.master_data.employee'],
          },
          {
            text: 'Aktivitas',
            link: '/daily-checklist/master-data/activity',
            permission: ['lti.daily_checklist.master_data.activity'],
          },
          {
            text: 'Kandang',
            link: '/daily-checklist/master-data/kandang',
            permission: ['lti.daily_checklist.master_data.kandang'],
          },
          {
            text: 'Konfigurasi',
            link: '/daily-checklist/master-data/configuration',
            permission: ['lti.daily_checklist.master_data.configuration'],
          },
        ],
      },
    ],
  },
  {
    text: 'Produksi',
    link: '/production',
    icon: 'heroicons-outline:wrench-screwdriver',
    permission: [
      'lti.production.project_flocks.list',
      'lti.production.recording.list',
      'lti.production.transfer_to_laying.list',
      'lti.production.uniformity.list',
    ],
    submenu: [
      {
        text: 'Daftar Flock',
        link: '/production/project-flock',
        permission: ['lti.production.project_flocks.list'],
      },
      {
        text: 'Recording',
        link: '/production/recording',
        permission: ['lti.production.recording.list'],
      },
      {
        text: 'Transfer ke Laying',
        link: '/production/transfer-to-laying',
        permission: ['lti.production.transfer_to_laying.list'],
      },
      {
        text: 'Uniformity',
        link: '/production/uniformity',
        permission: ['lti.production.uniformity.list'],
      },
    ],
  },
  {
    text: 'Pembelian',
    link: '/purchase',
    icon: 'heroicons-outline:shopping-cart',
    permission: ['lti.purchase.list'],
  },
  {
    text: 'Penjualan',
    link: '/marketing',
    icon: 'heroicons-outline:currency-dollar',
    permission: ['lti.marketing.delivery_order.list'],
  },
  {
    text: 'Keuangan',
    link: '/finance',
    icon: 'heroicons-outline:banknotes',
    permission: ['lti.finance.transactions.list'],
  },
  {
    text: 'Biaya',
    link: '/expense',
    icon: 'heroicons:wallet',
    permission: ['lti.expense.list'],
  },
  {
    text: 'Closing',
    link: '/closing',
    icon: 'heroicons-outline:presentation-chart-bar',
    permission: ['lti.closing.list'],
  },
  {
    text: 'Laporan',
    link: '/report',
    icon: 'mdi:chart-box-outline',
    permission: [
      'lti.repport.debtsupplier.list',
      'lti.repport.customerpayment.list',
      'lti.repport.purchasesupplier.list',
      'lti.repport.expense.list',
      'lti.repport.delivery.list',
      'lti.repport.gethppperkandang.list',
      'lti.repport.production_result.list',
    ],
    submenu: [
      {
        text: 'Keuangan',
        link: '/report/finance',
        permission: [
          'lti.repport.debtsupplier.list',
          'lti.repport.customerpayment.list',
        ],
      },
      {
        text: 'Logistik & Persediaan',
        link: '/report/logistic-stock',
        permission: ['lti.repport.purchasesupplier.list'],
      },
      {
        text: 'Biaya Operasional',
        link: '/report/expense',
        permission: ['lti.repport.expense.list'],
      },
      {
        text: 'Penjualan',
        link: '/report/marketing',
        permission: [
          'lti.repport.delivery.list',
          'lti.repport.gethppperkandang.list',
        ],
      },
      {
        text: 'Hasil Produksi',
        link: '/report/production-result',
        permission: ['lti.repport.production_result.list'],
      },
    ],
  },
  {
    text: 'Persediaan',
    link: '/inventory',
    icon: 'heroicons-outline:folder',
    permission: [
      'lti.inventory.product_stock.list',
      'lti.inventory.stock_log.list',
      'lti.inventory.product_warehouses.list',
      'lti.inventory.transfer.list',
    ],
    submenu: [
      {
        text: 'Stok Produk',
        link: '/inventory/product',
        permission: [
          'lti.inventory.product_stock.list',
          'lti.inventory.stock_log.list',
        ],
      },
      {
        text: 'Penyesuaian Stok',
        link: '/inventory/adjustment',
        permission: ['lti.inventory.product_stock.list'],
      },
      {
        text: 'Transfer Stok',
        link: '/inventory/movement',
        permission: ['lti.inventory.transfer.list'],
      },
    ],
  },
  {
    text: 'Master Data',
    link: '/master-data',
    icon: 'heroicons-outline:circle-stack',
    permission: [
      'lti.master.area.list',
      'lti.master.banks.list',
      'lti.master.customer.list',
      'lti.master.flocks.list',
      'lti.master.kandangs.list',
      'lti.master.locations.list',
      'lti.master.nonstocks.list',
      'lti.master.product_categories.list',
      'lti.master.products.list',
      'lti.master.suppliers.list',
      'lti.master.uoms.list',
      'lti.master.warehouses.list',
      'lti.master.production_standards.list',
      'lti.system_settings.update',
    ],
    submenu: [
      {
        text: 'Produk',
        link: '/master-data/product',
        permission: ['lti.master.products.list'],
      },
      {
        text: 'Kategori Produk',
        link: '/master-data/product-category',
        permission: ['lti.master.product_categories.list'],
      },
      {
        text: 'Bank',
        link: '/master-data/bank',
        permission: ['lti.master.banks.list'],
      },
      {
        text: 'Area',
        link: '/master-data/area',
        permission: ['lti.master.area.list'],
      },
      {
        text: 'Lokasi',
        link: '/master-data/location',
        permission: ['lti.master.locations.list'],
      },
      {
        text: 'Kandang',
        link: '/master-data/kandang',
        permission: ['lti.master.kandangs.list'],
      },
      {
        text: 'Warehouse',
        link: '/master-data/warehouse',
        permission: ['lti.master.warehouses.list'],
      },
      {
        text: 'Customer',
        link: '/master-data/customer',
        permission: ['lti.master.customer.list'],
      },
      {
        text: 'UOM',
        link: '/master-data/uom',
        permission: ['lti.master.uoms.list'],
      },
      {
        text: 'Non-Stock',
        link: '/master-data/nonstock',
        permission: ['lti.master.nonstocks.list'],
      },
      {
        text: 'Supplier',
        link: '/master-data/supplier',
        permission: ['lti.master.suppliers.list'],
      },
      {
        text: 'Flock',
        link: '/master-data/flock',
        permission: ['lti.master.flocks.list'],
      },
      {
        text: 'Standar Produksi',
        link: '/master-data/production-standard',
        permission: ['lti.master.production_standards.list'],
      },
      {
        text: 'Konfigurasi Sistem',
        link: '/master-data/system-config',
        permission: ['lti.system_settings.update'],
      },
    ],
  },
] as const;

export const ROWS_OPTIONS = [
  {
    label: '10',
    value: 10,
  },
  {
    label: '20',
    value: 20,
  },
  {
    label: '50',
    value: 50,
  },
  {
    label: '100',
    value: 100,
  },
];

export const WAREHOUSE_TYPE_OPTIONS = [
  {
    label: 'AREA',
    value: 'AREA',
  },
  {
    label: 'LOKASI',
    value: 'LOKASI',
  },
  {
    label: 'KANDANG',
    value: 'KANDANG',
  },
];

export const TYPE_OPTIONS = [
  {
    label: 'INDIVIDUAL',
    value: 'INDIVIDUAL',
  },
  {
    label: 'BISNIS',
    value: 'BISNIS',
  },
];

export const CATEGORY_OPTIONS = [
  {
    label: 'BOP',
    value: 'BOP',
  },
  {
    label: 'SAPRONAK',
    value: 'SAPRONAK',
  },
];

export const FLOCK_CATEGORY_OPTIONS = [
  {
    label: 'GROWING',
    value: 'GROWING',
  },
  {
    label: 'LAYING',
    value: 'LAYING',
  },
];
export const PRODUCT_FLAG_OPTIONS = [
  { label: 'DOC', value: 'DOC' },
  { label: 'EKSPEDISI', value: 'EKSPEDISI' },
  { label: 'FINISHER', value: 'FINISHER' },
  { label: 'ACTIVE', value: 'IS_ACTIVE' },
  { label: 'KIMIA', value: 'KIMIA' },
  { label: 'LAYER', value: 'LAYER' },
  { label: 'OBAT', value: 'OBAT' },
  { label: 'OVK', value: 'OVK' },
  { label: 'PAKAN', value: 'PAKAN' },
  { label: 'PRE-STARTER', value: 'PRE-STARTER' },
  { label: 'PULLET', value: 'PULLET' },
  { label: 'STARTER', value: 'STARTER' },
  { label: 'VITAMIN', value: 'VITAMIN' },
];

export const PRODUCT_FLAG_MAPPING = {
  flags: [
    { label: 'Ayam', value: 'AYAM' },
    { label: 'Pakan', value: 'PAKAN' },
    { label: 'OVK', value: 'OVK' },
    { label: 'Telur', value: 'TELUR' },
  ],
  options: [
    {
      flag: { label: 'Ayam', value: 'AYAM' },
      sub_flags: [
        { label: 'Ayam Afkir', value: 'AYAM-AFKIR' },
        { label: 'Ayam Culling', value: 'AYAM-CULLING' },
        { label: 'Ayam Mati', value: 'AYAM-MATI' },
      ],
      allow_without_sub_flag: true,
    },
    {
      flag: { label: 'Pakan', value: 'PAKAN' },
      sub_flags: [
        { label: 'Pre Starter', value: 'PRE-STARTER' },
        { label: 'Starter', value: 'STARTER' },
        { label: 'Finisher', value: 'FINISHER' },
      ],
      allow_without_sub_flag: false,
    },
    {
      flag: { label: 'OVK', value: 'OVK' },
      sub_flags: [
        { label: 'Obat', value: 'OBAT' },
        { label: 'Vitamin', value: 'VITAMIN' },
        { label: 'Kimia', value: 'KIMIA' },
      ],
      allow_without_sub_flag: false,
    },
    {
      flag: { label: 'Telur', value: 'TELUR' },
      sub_flags: [
        { label: 'Telur Utuh', value: 'TELUR-UTUH' },
        { label: 'Telur Putih', value: 'TELUR-PUTIH' },
        { label: 'Telur Retak', value: 'TELUR-RETAK' },
        { label: 'Telur Pecah', value: 'TELUR-PECAH' },
        { label: 'Telur Papacal', value: 'TELUR-PAPACAL' },
        { label: 'Telur Jumbo', value: 'TELUR-JUMBO' },
      ],
      allow_without_sub_flag: false,
    },
  ],
  sub_flag_to_flag: {
    'TELUR-RETAK': 'TELUR',
    STARTER: 'PAKAN',
    FINISHER: 'PAKAN',
    VITAMIN: 'OVK',
    KIMIA: 'OVK',
    'TELUR-UTUH': 'TELUR',
    'AYAM-MATI': 'AYAM',
    'PRE-STARTER': 'PAKAN',
    'TELUR-JUMBO': 'TELUR',
    'TELUR-PAPACAL': 'TELUR',
    'AYAM-AFKIR': 'AYAM',
    'AYAM-CULLING': 'AYAM',
    OBAT: 'OVK',
    'TELUR-PUTIH': 'TELUR',
    'TELUR-PECAH': 'TELUR',
  },
} as const;

export const SUPPLIER_FLAG_OPTIONS = [
  { label: 'EKSPEDISI', value: 'EKSPEDISI' },
];

export const RECORDING_FLAG_OPTIONS = [
  { label: 'Ayam Afkir', value: 'Ayam Afkir' },
  { label: 'Ayam Culling', value: 'Ayam Culling' },
  { label: 'Ayam Mati', value: 'Ayam Mati' },
];

export const FINANCE_PARTY_TYPE_OPTIONS = [
  { label: 'Customer', value: 'CUSTOMER' },
  { label: 'Supplier', value: 'SUPPLIER' },
];

export const FINANCE_PAYMENT_METHOD_OPTIONS = [
  { label: 'Transfer', value: 'TRANSFER' },
  { label: 'Cash', value: 'CASH' },
  { label: 'Card', value: 'CARD' },
  { label: 'Cheque', value: 'CHEQUE' },
  { label: 'Saldo', value: 'SALDO' },
];

export const FINANCE_INITIAL_BALANCE_TYPE_OPTIONS = [
  { label: 'Saldo Awal Positif', value: 'POSITIVE' },
  { label: 'Saldo Awal Negatif', value: 'NEGATIVE' },
];

export const FINANCE_INJECTION_TYPE_OPTIONS = [
  { label: 'Saldo Injection Positif', value: 'POSITIVE' },
  { label: 'Saldo Injection Negatif', value: 'NEGATIVE' },
];

export const FINANCE_TRANSACTION_TYPE_OPTIONS = [
  { label: 'Pembelian', value: 'PEMBELIAN' },
  { label: 'Penjualan', value: 'PENJUALAN' },
  { label: 'Biaya', value: 'BIAYA' },
  { label: 'Saldo Awal', value: 'SALDO_AWAL' },
  { label: 'Injection', value: 'INJECTION' },
];

export const FINANCE_TRANSACTION_STATUS = ['PENJUALAN', 'PEMBELIAN', 'BIAYA'];

export const FINANCE_INITIAL_BALANCE_STATUS = ['SALDO_AWAL'];

export const FINANCE_INJECTION_STATUS = ['INJECTION'];

export const APPROVAL_WORKFLOWS = {
  PROJECT_FLOCKS: [
    {
      step_number: 1,
      step_name: 'Pengajuan',
    },
    {
      step_number: 2,
      step_name: 'Aktif',
    },
    {
      step_number: 3,
      step_name: 'Selesai',
    },
  ],
  PROJECT_FLOCK_KANDANGS: [
    {
      step_number: 1,
      step_name: 'Pengajuan',
    },
    {
      step_number: 2,
      step_name: 'Disetujui',
    },
    {
      step_number: 3,
      step_name: 'Selesai',
    },
  ],
  RECORDINGS: [
    {
      step_number: 1,
      step_name: 'Pengajuan',
    },
    {
      step_number: 2,
      step_name: 'Disetujui',
    },
  ],

  TRANSFER_TO_LAYINGS: [
    {
      step_number: 1,
      step_name: 'Pengajuan',
    },
    {
      step_number: 2,
      step_name: 'Disetujui',
    },
  ],
};

export const PROJECT_FLOCK_STATUS = {
  PENGAJUAN: APPROVAL_WORKFLOWS.PROJECT_FLOCKS[0].step_name,
  AKTIF: APPROVAL_WORKFLOWS.PROJECT_FLOCKS[1].step_name,
  SELESAI: APPROVAL_WORKFLOWS.PROJECT_FLOCKS[2].step_name,
} as const;

export const ACCEPTED_FILE_TYPE = {
  PDF: {
    'application/pdf': ['.pdf'],
  },
  IMAGE: {
    'image/*': [],
  },
};

export const S3_PUBLIC_BASE_URL = process.env
  .NEXT_PUBLIC_S3_PUBLIC_BASE_URL as string;

export const FILTER_TYPE_OPTIONS = [
  {
    label: 'Tanggal Realisasi',
    value: 'REALIZATION_DATE',
  },
  {
    label: 'Tanggal DO',
    value: 'DO_DATE',
  },
];

export const MARKETING_TYPE_OPTIONS = [
  {
    label: 'Ayam',
    value: 'AYAM,AYAM_PULLET',
  },
  {
    label: 'Trading',
    value: 'TRADING',
  },
  {
    label: 'Telur',
    value: 'TELUR',
  },
];

export const MARKETING_CONVERTION_UNIT_OPTIONS = [
  {
    label: 'Kg',
    value: 'kg',
  },
  {
    label: 'Qty',
    value: 'qty',
  },
  {
    label: 'Peti',
    value: 'peti',
  },
];

export const MARKETING_DATE_FILTER_TYPE_OPTIONS = [
  {
    label: 'Tanggal Realisasi',
    value: 'realization_date',
  },
  {
    label: 'Tanggal SO',
    value: 'so_date',
  },
];

export const TRANSACTION_TYPE_OPTIONS = [
  { label: 'Pembelian', value: 'PEMBELIAN' },
  { label: 'Penjualan', value: 'PENJUALAN' },
  { label: 'Recording', value: 'RECORDING' },
];

export const TRANSACTION_SUBTYPE_OPTIONS = {
  PEMBELIAN: { label: 'Pembelian', value: 'PURCHASE_IN' },
  PENJUALAN: { label: 'Penjualan', value: 'MARKETING_OUT' },
  RECORDING: [
    { label: 'Recording Stock', value: 'RECORDING_STOCK_OUT' },
    { label: 'Recording Depletion', value: 'RECORDING_DEPLETION_IN' },
    { label: 'Recording Egg', value: 'RECORDING_EGG_IN' },
  ],
} as const;
