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

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