import StockEventIcon from '../../components/Icons/StockEventIcon'

export const StockEvent = {
  name: 'stockEvent',
  label: 'Stock Event',
  labelPlural: 'Stock Events',
  url: '/dashboard/inventory/stockevents',
  prefix: 'SEV',
  icon: StockEventIcon,
  actions: [],
  columns: ['_reference', 'owner', 'parent', 'value', 'createdAt', 'updatedAt'],
  filters: [
    'owner._id',
    'parent._id',
    'createdAt',
    'updatedAt',
    '_reference'
  ],
  sorters: ['createdAt','updatedAt'],
  properties: [
    {
      name: '_id',
      label: 'ID',
      type: 'id',
      objectType: 'stockEvent',
      columnFixed: 'left',
      value: null,
      showCopy: true,
      columnWidth: 140
    },
    {
      name: 'createdAt',
      label: 'Created At',
      type: 'dateTime',
      value: null,
      readOnly: true,
      columnWidth: 175
    },
    {
      name: '_reference',
      label: 'Reference',
      type: 'reference',
      columnFixed: 'left',
      objectType: 'stockEvent',
      value: null,
      showCopy: true,
      readOnly: true,
      columnWidth: 180
    },
    {
      name: 'updatedAt',
      label: 'Updated At',
      type: 'dateTime',
      value: null,
      readOnly: true,
      columnWidth: 175
    },
    {
      name: 'owner',
      label: 'Owner',
      type: 'object',
      objectType: (objectData) => {
        return objectData.ownerType
      },
      columnFixed: 'left',
      columnWidth: 200,
      value: null,
      showCopy: true,
      showHyperlink: true
    },
    {
      name: 'parent',
      label: 'Parent',
      type: 'object',
      objectType: (objectData) => {
        return objectData?.parentType
      },
      value: null,
      columnWidth: 200,
      showCopy: true,
      showHyperlink: true
    },
    {
      name: 'value',
      label: 'Value',
      columnWidth: 120,
      type: 'variance',
      showCopy: true,
      suffix: (objectData) => {
        return objectData.unit
      }
    }
  ]
}
