import DownloadIcon from '../../components/Icons/DownloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import GCodeFileIcon from '../../components/Icons/GCodeFileIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'

export const GCodeFile = {
  name: 'gcodeFile',
  label: 'GCode File',
  prefix: 'GCF',
  icon: GCodeFileIcon,
  actions: [
    {
      name: 'info',
      label: 'Info',
      default: true,
      row: true,
      icon: InfoCircleIcon,
      url: (_id) => `/dashboard/production/gcodefiles/info?gcodeFileId=${_id}`
    },
    {
      name: 'reload',
      label: 'Reload',
      icon: ReloadIcon,
      url: (_id) =>
        `/dashboard/production/gcodefiles/info?gcodeFileId=${_id}&action=reload`
    },
    {
      name: 'download',
      label: 'Download',
      row: true,
      icon: DownloadIcon,
      url: (_id) =>
        `/dashboard/production/gcodefiles/info?gcodeFileId=${_id}&action=download`
    },
    {
      name: 'edit',
      label: 'Edit',
      row: true,
      icon: EditIcon,
      url: (_id) =>
        `/dashboard/production/gcodefiles/info?gcodeFileId=${_id}&action=edit`
    }
  ],

  columns: [
    'name',
    '_id',
    'filament',
    'gcodeFileInfo.estimatedPrintingTimeNormalMode',
    'gcodeFileInfo.sparseInfillDensity',
    'gcodeFileInfo.sparseInfillPattern',
    'gcodeFileInfo.nozzleTemperature',
    'gcodeFileInfo.hotPlateTemp',
    'updatedAt'
  ],
  filters: ['_id', 'name', 'updatedAt'],
  sorters: ['name', 'createdAt', 'updatedAt'],
  group: ['filament'],
  properties: [
    {
      name: '_id',
      label: 'ID',
      type: 'id',
      objectType: 'gcodeFile',
      columnFixed: 'left',
      value: null,
      showCopy: true
    },
    {
      name: 'createdAt',
      label: 'Created At',
      type: 'dateTime',
      value: null,
      readOnly: true
    },
    {
      name: 'name',
      label: 'Name',
      columnFixed: 'left',
      type: 'text',
      value: null,
      required: true
    },
    {
      name: 'updatedAt',
      label: 'Updated At',
      type: 'dateTime',
      value: null,
      readOnly: true
    },
    {
      name: 'filament',
      label: 'Filament',
      type: 'object',
      value: null,
      objectType: 'filament',
      required: true
    },
    {
      name: 'cost',
      label: 'Cost',
      type: 'number',
      value: null,
      readOnly: true,
      prefix: '£'
    },
    {
      name: 'gcodeFileInfo.estimatedPrintingTimeNormalMode',
      label: 'Est Print Time',
      value: null,
      type: 'text',
      readOnly: true
    },
    {
      name: 'gcodeFileInfo.sparseInfillDensity',
      label: 'Infill Density',
      columnWidth: 150,
      type: 'text',
      readOnly: true
    },
    {
      name: 'gcodeFileInfo.sparseInfillPattern',
      label: 'Infill Pattern',
      type: 'text',
      readOnly: true
    },
    {
      name: 'gcodeFileInfo.filamentUsedMm',
      label: 'Filament Used (mm)',
      type: 'number',
      readOnly: true,
      suffix: 'mm'
    },
    {
      name: 'gcodeFileInfo.filamentUsedG',
      label: 'Filament Used (g)',
      type: 'number',
      suffix: 'g',
      readOnly: true
    },
    {
      name: 'gcodeFileInfo.nozzleTemperature',
      label: 'Hotend Temp',
      columnWidth: 150,
      type: 'number',
      suffix: '°',
      readOnly: true
    },
    {
      name: 'gcodeFileInfo.hotPlateTemp',
      label: 'Bed Temp',
      columnWidth: 150,
      type: 'number',
      suffix: '°',
      readOnly: true
    },
    {
      name: 'gcodeFileInfo.filamentSettingsId',
      label: 'Filament Profile',
      type: 'text',
      readOnly: true
    },
    {
      name: 'gcodeFileInfo.printSettingsId',
      label: 'Print Profile',
      type: 'text',
      readOnly: true
    }
  ]
}
