import { AssetsRecord } from 'types/default';
import { ActionTable } from './constants';

export interface Os {
  id: number;
  description?: string;
  name: string;
}

type GroupAsset = {
  id: number;
  name: string;
  description: string;
  collapsed: boolean;
};
export type ManufacturerAsset = {
  id: number;
  name: string;
  description: string;
};
type IncidentsEventsAsset = {
  type: string;
  Index: string;
  sign_id: string;
  '@created': string;
  event_id: string;
  rule_tags: string;
  sign_name: string;
  source_ip: string;
  '@timestamp': string;
  event_hash: string;
  event_last: string;
  source_mac: string;
  celery_done: true;
  event_count: number;
  event_first: string;
  source_host: string;
  source_port: number;
  source_user: string;
  aggregated_id: string;
  device_action: string;
  device_vendor: string;
  event_src_msg: string;
  sign_category: string;
  destination_ip: string;
  device_product: string;
  device_version: string;
  event_protocol: string;
  event_severity: number;
  event_timestamp: string;
  destination_host: string;
  destination_port: number;
  destination_user: string;
  sign_subcategory: string;
};
type IncidentsAsset = {
  user_friendly_id: number;
  timestamp: string;
  incident_id: string;
  title: string;
  category: {
    name: string;
    description: string;
    id: number;
  };
  importance: number;
  status: number;
  assigned_to: string;
  event_count: number;
  created: string;
  updated: string;
  events: IncidentsEventsAsset[];
  deadline: string;
  comment: string;
};

export interface Asset {
  id?: number;
  name: string;
  asset_type: string;
  status: number;
  ip: string;
  updated: string;
  description: string | null;
  sensor: string | null;
  model: string | null;
  mac: string | null;
  ports: number[] | null;
  os: Os[] | null;
  group: GroupAsset | null;
  manufacturer: ManufacturerAsset | null;
  incidents: IncidentsAsset[] | [];
  vulnerabilities: number;
}

export interface AssetPatch extends AssetsRecord {
  description: string;
  sensor: string;
  model: string;
  mac: string;
  ports: number[];
  os: number;
  group: number;
  manufacturer: number;
}
export interface AssetPatchIncoming extends AssetsRecord {
  ports: string;
}

export type TOsList = {
  id?: number;
  name: string;
  description: string;
};
export enum Status {
  ONE = 0,
  ZERO = 1,
}

export type TypeMessagesConfig = {
  assetsTable: {
    delete: {
      title: string;
      popoverTitle: string;
    };
    changeStatus: {
      title: string;
      popoverTitle: string;
    };
  };
  assetsGroups: {
    delete: {
      title: string;
      popoverTitle: string;
    };
  };
};

export type TypeCollectiveActionMessages = {
  [key in ActionTable]: string;
};
