import VendorIcon from '../../components/Icons/VendorIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'

export const Vendor = {
  name: 'vendor',
  label: 'Vendor',
  prefix: 'VEN',
  icon: VendorIcon,
  actions: [
    {
      name: 'info',
      label: 'Info',
      default: true,
      row: true,
      icon: InfoCircleIcon,
      url: (_id) => `/dashboard/management/vendors/info?vendorId=${_id}`
    },
    {
      name: 'reload',
      label: 'Reload',
      icon: ReloadIcon,
      url: (_id) =>
        `/dashboard/management/vendors/info?vendorId=${_id}&action=reload`
    },
    {
      name: 'edit',
      label: 'Edit',
      row: true,
      icon: EditIcon,
      url: (_id) =>
        `/dashboard/management/vendors/info?vendorId=${_id}&action=edit`
    },
    { type: 'divider' },
    {
      name: 'delete',
      label: 'Delete',
      icon: BinIcon,
      danger: true,
      url: (_id) =>
        `/dashboard/management/vendors/info?vendorId=${_id}&action=delete`
    }
  ],
  url: (id) => `/dashboard/management/vendors/info?vendorId=${id}`,
  columns: ['name', '_id', 'country', 'email', 'website', 'createdAt'],
  filters: ['name', '_id', 'country', 'email'],
  sorters: ['name', 'country', 'email', 'createdAt', '_id'],
  group: ['country'],
  properties: [
    {
      name: '_id',
      label: 'ID',
      columnFixed: 'left',
      type: 'id',
      objectType: 'vendor',
      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: 'contact',
      label: 'Contact',
      type: 'text',
      readOnly: false,
      required: false
    },
    {
      name: 'country',
      label: 'Country',
      type: 'country',
      readOnly: false,
      required: true
    },
    {
      name: 'email',
      label: 'Email',
      columnWidth: 300,
      type: 'email',
      readOnly: false,
      required: false
    },
    {
      name: 'phone',
      label: 'Phone',
      type: 'phone',
      readOnly: false,
      required: false
    },
    {
      name: 'website',
      label: 'Website',
      columnWidth: 300,
      type: 'url',
      readOnly: false,
      required: false
    }
  ]
}
