import {
  EndpointGroupName,
  FirewallGroupName,
  TEventsGroup,
  TGroup,
} from './types';

export const firewall = {
  [FirewallGroupName.Main]: [
    {
      name: 'Name',
      type: 'input',
      key: 'name',
      placeholder: 'Введите имя источника',
      subtitle: 'API-адрест устройства',
      required: true,
    },
    {
      name: 'IP',
      type: 'input',
      key: 'ip',
      placeholder: 'Введите IP-адрес источника событий',
      subtitle: 'API-адрест устройства',
      required: true,
    },
    {
      name: 'Key',
      type: 'input',
      key: 'key',
      placeholder: 'Введите ключ для подключения к источники событий',
      subtitle: 'API ключ для устройства',
      required: true,
    },
    {
      name: 'Secret',
      type: 'input',
      key: 'secret',
      placeholder: 'Введите секрет для подключения к источники событий',
      subtitle: 'Значение секрета API',
      required: true,
    },
    {
      name: 'Port',
      type: 'input',
      key: 'port',
      placeholder: 'Введите порт источника событий',
      subtitle: 'Порт для логов источника (UDP)',
      required: true,
    },
    {
      name: 'Manufacturer',
      type: 'input',
      key: 'manufacturer',
      placeholder: '',
      subtitle: '',
      required: false,
    },
    {
      name: 'Info',
      type: 'input',
      key: 'info',
      placeholder: '',
      subtitle: '',
      required: false,
    },
  ],
};

export const endpoint: TEventsGroup = {
  [EndpointGroupName.Main]: [
    { name: 'Name', type: 'input', key: 'name', gridId: 'item1' },
    { name: 'IP', type: 'input', key: 'ip', gridId: 'item2' },
    { name: 'Port', type: 'input', key: 'port', gridId: 'item3' },
    {
      name: 'Manufacturer',
      type: 'input',
      key: 'manufacturer',
      gridId: 'item4',
    },
    { name: 'Info', type: 'input', key: 'info', gridId: 'item5' },
  ],
  [EndpointGroupName.Scan]: [
    {
      name: 'Enable Integrity Control',
      type: 'checkbox',
      key: 'ic_enabled',
      gridId: 'item6',
    },
    {
      name: 'Event Buffering Period',
      type: 'input',
      key: 'ic_timeout',
      gridId: 'item7',
    },
    {
      name: '',
      type: 'table',
      key: 'ic_scan_folders',
      columnFields: [
        { title: 'Path', dataIndex: 'path', key: 'ic_scan_folders' },
        {
          title: 'Действия',
          dataIndex: 'actions',
          key: 'actions',
          fixed: 'right',
          width: 80,
          align: 'center',
        },
      ],
      gridId: 'item8',
    },
  ],
  [EndpointGroupName.WhiteList]: [
    {
      name: 'Enable whitelist',
      type: 'checkbox',
      key: 'wl_enable',
      gridId: 'item9',
    },
    {
      name: 'Local administrator ignores whitelist',
      type: 'checkbox',
      key: 'wl_admin',
      gridId: 'item10',
    },
    {
      name: 'White List',
      type: 'table',
      key: 'white_list',
      gridId: 'item11',
      columnFields: [
        { title: 'Path', dataIndex: 'path', key: 'white_list' },
        {
          title: 'Действия',
          dataIndex: 'actions',
          key: 'actions',
          fixed: 'right',
          width: 80,
          align: 'center',
        },
      ],
    },
  ],
  [EndpointGroupName.Device]: [
    {
      name: 'Enable device management',
      type: 'checkbox',
      key: 'usb_control_enabled',
      gridId: 'item12',
    },
    {
      name: 'Deny access to read CD/DVD',
      type: 'checkbox',
      key: 'prohibit_cd_access',
      gridId: 'item13',
    },
    {
      name: 'Blocking USB devices',
      type: 'checkbox',
      key: 'dc_enabled',
      gridId: 'item14',
    },
    {
      name: 'Scan',
      type: 'table',
      key: 'usb_allowed_storage',
      gridId: 'item15',
      columnFields: [
        { title: 'Path', dataIndex: 'path', key: 'connected' },
        { title: 'Path', dataIndex: 'path', key: 'controlStatus' },
        { title: 'Path', dataIndex: 'path', key: 'deviceClass' },
        { title: 'Path', dataIndex: 'path', key: 'deviceSubClass' },
        { title: 'Path', dataIndex: 'path', key: 'name' },
        { title: 'Path', dataIndex: 'path', key: 'sn' },
        {
          title: 'Действия',
          dataIndex: 'actions',
          key: 'actions',
          fixed: 'right',
          width: 80,
          align: 'center',
        },
      ],
    },
  ],
  [EndpointGroupName.Antivirus]: [
    {
      name: 'Enable Antivirus',
      type: 'checkbox',
      key: 'clamav_enabled',
      gridId: 'item16',
    },
    {
      name: 'Scan files for viruses on add',
      type: 'checkbox',
      key: 'clamav_scan_on_add',
      gridId: 'item17',
    },
    {
      name: 'Initiate antivirus scan',
      type: 'checkbox',
      key: 'clamav_start_scan',
      gridId: 'item18',
    },
    {
      name: 'Initiate antivirus db update',
      type: 'checkbox',
      key: 'clamav_update_db',
      gridId: 'item19',
    },
    {
      name: 'Load Update Files',
      type: 'button',
      key: 'load',
      gridId: 'item20',
    },
    { name: 'View Event Log', type: 'button', key: 'view', gridId: 'item21' },
    {
      name: 'Clamav_paths',
      type: 'table',
      key: 'clamav_paths',
      gridId: 'item22',
      columnFields: [
        { title: 'Path', dataIndex: 'path', key: 'clamav_paths' },
        {
          title: 'Действия',
          dataIndex: 'actions',
          key: 'actions',
          fixed: 'right',
          width: 80,
          align: 'center',
        },
      ],
    },
  ],
};

export const IEGroup: TGroup = {
  [EndpointGroupName.Main]: [endpoint[EndpointGroupName.Main]],
  [EndpointGroupName.Scan]: [endpoint[EndpointGroupName.Scan]],
  [EndpointGroupName.WhiteList]: [endpoint[EndpointGroupName.WhiteList]],
  [EndpointGroupName.Device]: [endpoint[EndpointGroupName.Device]],
  [EndpointGroupName.Antivirus]: [endpoint[EndpointGroupName.Antivirus]],
};

export const IFGroup: TGroup = {
  [FirewallGroupName.Main]: [firewall[FirewallGroupName.Main]],
};
