export type TypeCategory = '0' | '1' | '2';

export type TypeTlp = 'TLP:WHITE' | 'TLP:GREEN' | 'TLP:AMBER' | 'TLP:RED';

export type TypeNCIRCCNotificationSendConfig = {
  key: FormFields;
  name: FormFields;
  label: string;
  jsxElem?: JSX.Element;
  type?: 'collapsed';
  valuePropName?: 'checked';
  collapsedItems?: TypeNCIRCCNotificationSendConfig[];
  rules?: [{ required: true; message: string }];
  disabled?: boolean;
};

export type TypeNCIRCCNotificationShowConfig =
  | TypeNCIRCCNotificationSendConfig[]
  | (
      | TypeNCIRCCNotificationSendConfig
      | {
          jsxElem: JSX.Element;
          name: FormFields;
          label: string;
          key: FormFields;
        }
    )[];

export enum FormFields {
  ID = 'id',
  INCIDENT = 'incident',
  UPDATE_TIME = 'update_time',
  UUID = 'uuid',
  IDENTIFIER = 'identifier',
  CATEGORY = 'category',
  TYPE = 'type',
  ACTIVITY_STATUS = 'activity_status',
  TLP = 'tlp',
  AFFECTED_SYSTEM_NAME = 'affected_system_name',
  AFFECTED_SYSTEM_CATEGORY = 'affected_system_category',
  EVENT_DESCRIPTION = 'event_description',
  AFFECTED_SYSTEM_CONNECTION = 'affected_system_connection',
  ASSISTANCE = 'assistance',
  NOTIFICATION_STATUS = 'notification_status',
  VULNERABILITY_ID = 'vulnerability_id',
  PRODUCT_CATEGORY = 'product_category',
  INTEGRITY_IMPACT = 'integrity_impact',
  AVAILABILITY_IMPACT = 'availability_impact',
  CONFIDENTIALITY_IMPACT = 'confidentiality_impact',
  CUSTOM_IMPACT = 'custom_impact',
  CREATED = 'created',
  UPDATED = 'updated',
  COMMENTS_COUNT = 'comments_count',
  EFFECTS = 'effects',
  ADDITIONAL = 'additional',
}

export type TypeNCIRCCNotificationResponse = {
  [FormFields.ID]: number;
  [FormFields.INCIDENT]: string;
  [FormFields.UPDATE_TIME]: string;
  [FormFields.UUID]: string;
  [FormFields.IDENTIFIER]: string;
  [FormFields.CATEGORY]: string;
  [FormFields.TYPE]: string;
  [FormFields.ACTIVITY_STATUS]: string;
  [FormFields.TLP]: TypeTlp;
  [FormFields.AFFECTED_SYSTEM_NAME]: string;
  [FormFields.AFFECTED_SYSTEM_CATEGORY]: string;
  [FormFields.EVENT_DESCRIPTION]: string;
  [FormFields.AFFECTED_SYSTEM_CONNECTION]: boolean;
  [FormFields.ASSISTANCE]: boolean;
  [FormFields.NOTIFICATION_STATUS]: string;
  [FormFields.VULNERABILITY_ID]: string;
  [FormFields.PRODUCT_CATEGORY]: string;
  [FormFields.INTEGRITY_IMPACT]: string;
  [FormFields.AVAILABILITY_IMPACT]: string;
  [FormFields.CONFIDENTIALITY_IMPACT]: string;
  [FormFields.CUSTOM_IMPACT]: string;
  [FormFields.CREATED]: string;
  [FormFields.UPDATED]: string;
  [FormFields.COMMENTS_COUNT]: number;
  [FormFields.EFFECTS]: string;
  [FormFields.ADDITIONAL]: string;
};

export interface FieldData {
  name: string | number | (string | number)[];
  value?: any;
  touched?: boolean;
  validating?: boolean;
  errors?: string[];
}
