import EditIcon from '../../components/Icons/EditIcon'
import FilamentIcon from '../../components/Icons/FilamentIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'

export const Filament = {
  name: 'filament',
  label: 'Filament',
  prefix: 'FIL',
  icon: FilamentIcon,
  actions: [
    {
      name: 'info',
      label: 'Info',
      default: true,
      row: true,
      icon: InfoCircleIcon,
      url: (_id) => `/dashboard/management/filaments/info?filamentId=${_id}`
    },
    {
      name: 'reload',
      label: 'Reload',
      icon: ReloadIcon,
      url: (_id) =>
        `/dashboard/management/filaments/info?filamentId=${_id}&action=reload`
    },
    {
      name: 'edit',
      label: 'Edit',
      row: true,
      icon: EditIcon,
      url: (_id) =>
        `/dashboard/management/filaments/info?filamentId=${_id}&action=edit`
    }
  ],
  columns: [
    '_id',
    'name',
    'type',
    'color',
    'vendor',
    'vendor._id',
    'cost',
    'density',
    'diameter',
    'createdAt',
    'updatedAt'
  ],
  filters: ['_id', 'name', 'type', 'color', 'cost', 'vendor', 'vendor._id'],
  sorters: [
    'name',
    'createdAt',
    'type',
    'vendor',
    'cost',
    'updatedAt',
    'createdAt'
  ],
  group: ['diameter', 'type', 'vendor'],
  properties: [
    {
      name: '_id',
      label: 'ID',
      columnFixed: 'left',
      type: 'id',
      objectType: 'filament',
      showCopy: true
    },
    {
      name: 'createdAt',
      label: 'Created At',
      type: 'dateTime',
      readOnly: true
    },
    {
      name: 'name',
      label: 'Name',
      columnFixed: 'left',
      required: true,
      type: 'text'
    },
    {
      name: 'updatedAt',
      label: 'Updated At',
      type: 'dateTime',
      readOnly: true
    },
    {
      name: 'vendor',
      label: 'Vendor',
      required: true,
      type: 'object',
      objectType: 'vendor'
    },
    {
      name: 'vendor._id',
      label: 'Vendor ID',
      type: 'id',
      objectType: 'vendor',
      showCopy: true,
      showHyperlink: true
    },
    {
      name: 'type',
      label: 'Material',
      required: true,
      columnWidth: 150,
      type: 'material'
    },
    {
      name: 'cost',
      label: 'Cost',
      columnWidth: 150,
      required: true,
      type: 'currency'
    },
    {
      name: 'color',
      label: 'Color',
      columnWidth: 150,
      required: true,
      type: 'color'
    },
    {
      name: 'diameter',
      label: 'Diameter',
      columnWidth: 150,
      required: true,
      type: 'number',
      suffix: 'mm'
    },
    {
      name: 'density',
      label: 'Density',
      columnWidth: 150,
      required: true,
      type: 'number',
      suffix: 'g/cm³'
    },
    {
      name: 'emptySpoolWeight',
      label: 'Spool Weight',
      required: true,
      columnWidth: 150,
      type: 'number',
      suffix: 'g'
    },
    {
      name: 'url',
      label: 'Link',
      required: false,
      type: 'url'
    },
    {
      name: 'barcode',
      label: 'Barcode',
      required: false,
      type: 'text'
    }
  ]
}
