{"size": 2073, "ext": "js", "max_stars_repo_path": "ConfigEntities/entities/UnitFields.js", "max_stars_repo_name": "SUNET/sri-front", "max_stars_repo_stars_event_min_datetime": "2020-03-18T09:11:06.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-18T09:11:06.000Z", "max_issues_repo_path": "ConfigEntities/entities/UnitFields.js", "max_issues_repo_name": "SUNET/sri-front", "max_issues_repo_issues_event_min_datetime": "2020-03-12T10:53:28.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-17T12:34:15.000Z", "max_forks_repo_path": "ConfigEntities/entities/UnitFields.js", "max_forks_repo_name": "SUNET/sri-front", "max_forks_repo_forks_event_min_datetime": "2020-03-12T10:46:59.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-18T14:25:12.000Z"}
{"max_stars_count": 1, "max_issues_count": 66, "max_forks_count": 4, "avg_line_length": 26.5769230769, "max_line_length": 96, "alphanum_fraction": 0.5803183792}
const FIELD_TYPES = require('../FieldsTypes');
const COMMON_FIELDS = require('../CommonFields');

const generateDependEntities = (name) => {
  return {
    type: FIELD_TYPES.ARRAY_LIST,
    name: name,
    subFields: [...COMMON_FIELDS.BASIC_INFO, { type: FIELD_TYPES.SINGLE, name: 'relation_id' }],
    onSentences: [
      {
        entity: 'Service',
        subFields: [
          { type: FIELD_TYPES.ID_OBJECT, name: 'service_type', alias: 'type' },
          { type: FIELD_TYPES.OBJECT, name: 'operational_state' },
        ],
      },
      {
        entity: 'OpticalPath',
        subFields: [
          { type: FIELD_TYPES.SINGLE, name: 'wavelength' },
          { type: FIELD_TYPES.OBJECT, name: 'framing' },
          { type: FIELD_TYPES.OBJECT, name: 'capacity' },
          { type: FIELD_TYPES.OBJECT, name: 'operational_state' },
        ],
      },
      {
        entity: 'OpticalMultiplexSection',
        subFields: [{ type: FIELD_TYPES.OBJECT, name: 'operational_state' }],
      },
      {
        entity: 'OpticalLink',
        subFields: [
          { type: FIELD_TYPES.OBJECT, name: 'link_type', alias: 'type' },
          { type: FIELD_TYPES.OBJECT, name: 'interface_type' },
          { type: FIELD_TYPES.OBJECT, name: 'operational_state' },
        ],
      },
    ],
  };
};

const UNIT_COMMON_FIELDS = [
  ...COMMON_FIELDS.BASIC_INFO,
  { type: FIELD_TYPES.SINGLE, name: 'ip_addresses' },
  { type: FIELD_TYPES.SINGLE, name: 'vlan' },
  generateDependEntities('dependents'),
  generateDependEntities('dependencies'),
  {
    type: FIELD_TYPES.ID_OBJECT,
    name: 'part_of',
    subFields: [
      {
        type: FIELD_TYPES.ID_OBJECT,
        name: 'parent',
        onSentences: [
          {
            entity: 'Router',
            subFields: [...COMMON_FIELDS.COMPLETE_LOCATION],
          },
        ],
      },
    ],
  },

  ...COMMON_FIELDS.COMMENTS_FIELDS,
  ...COMMON_FIELDS.USER_CREATOR_MODIFIER_FIELDS,
];

const UNIT_SUNET = [];

const UNIT_NORDUNI = [];

module.exports = {
  UNIT_COMMON_FIELDS,
  UNIT_SUNET,
  UNIT_NORDUNI,
};
