import PersonIcon from '../../components/Icons/PersonIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'

export const User = {
  name: 'user',
  label: 'User',
  prefix: 'USR',
  icon: PersonIcon,
  actions: [
    {
      name: 'info',
      label: 'Info',
      default: true,
      row: true,
      icon: InfoCircleIcon,
      url: (_id) => `/dashboard/management/users/info?userId=${_id}`
    },
    {
      name: 'reload',
      label: 'Reload',
      icon: ReloadIcon,
      url: (_id) =>
        `/dashboard/management/users/info?userId=${_id}&action=reload`
    }
  ],
  columns: ['name', '_id', 'username', 'email', 'role', 'createdAt'],
  filters: ['name', '_id', 'email', 'role'],
  sorters: ['name', 'email', 'role', 'createdAt', '_id'],
  properties: [
    {
      name: '_id',
      label: 'ID',
      columnFixed: 'left',
      type: 'id',
      objectType: 'user',
      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: 'firstName',
      label: 'First Name',
      type: 'text'
    },
    {
      name: 'username',
      label: 'Username',
      required: true,
      type: 'text'
    },
    {
      name: 'lastName',
      label: 'Last Name',
      type: 'text'
    },
    {
      name: 'email',
      label: 'Email',
      columnWidth: 300,
      type: 'email'
    }
  ]
}
