///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
/// <reference types="Cypress" />
import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
import {AsyncInstantiationModel} from "../../support/jsonBuilders/models/asyncInstantiation.model";

var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
var jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>();
const SERVICE_MODEL_ID: string = '6e59c5de-f052-46fa-aa7e-2fca9d674c44';
const SERVICE_INVARIANT_ID: string = "d27e42cf-087e-4d31-88ac-6c4b7585f800";

export const initServicePlanning = function (viewOrEdit: string, customModelFilePath?: string ){
  const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
  const SERVICE_TYPE: string = "TYLER SILVIA";
  const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
  if (Cypress._.isNil(customModelFilePath)){
    customModelFilePath = '../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceInstance.json';
  }

  cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceModel.json').then((res) => {
    jsonBuilderAndMock.basicJson(
      res,
      Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44",
      200,
      0,
      "ServiceTreeWithMultipleChildren_serviceModel",
    )
  });

  cy.readFile(customModelFilePath).then((res) => {
    jsonBuilderAndMock.basicJson(
      res,
      Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
      200, 0,
      "ServiceTreeWithMultipleChildren_serviceInstance",
    );
  });
  cy.openIframe(`app/ui/#/servicePlanning/${viewOrEdit}?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
}

describe('View only drawing board', function () {
  const _VIEW = "VIEW";

  beforeEach(() => {
    cy.window().then((win) => {
      win.sessionStorage.clear();
      cy.preventErrorsOnLoading();
      cy.initAAIMock();
      cy.initVidMock({serviceUuid:SERVICE_MODEL_ID, invariantId: SERVICE_INVARIANT_ID});
      cy.initZones();
      cy.permissionVidMock();
      cy.login();
    });
  });

  afterEach(() => {
    cy.screenshot();
  });

  it('error should display on api error', function () {
    const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
    const SERVICE_TYPE: string = "TYLER SILVIA";
    const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
    const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';

    cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
      jsonBuilderInstantiationBuilder.basicJson(
        res,
        Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450",
        500,
        0,
        "error 500 getServiceInstanceTopology"
      );

      cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);

      cy.get('div.title')
        .contains('Server not available');

    });
  });

  it(`when open service planning in view mode service instance is shown as expected`, function () {
    const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
    const SERVICE_TYPE: string = "TYLER SILVIA";
    const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
    const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';

    cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
      jsonBuilderAndMock.basicJson(
        res,
        Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450",
        200,
        0,
        "ecompNamingFalseModel",
      )
    });

    cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => {
      jsonBuilderAndMock.basicJson(
        res,
        Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
        200, 0,
        "initServiceInstanceTopology",
      )
    });

    cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
    //cy.visit("welcome.htm"); //relaod page to not break the following tests

    //testing left side
    cy.getElementByDataTestsId('node-2017-388_PASQUALE-vPE 1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF');
    cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0').click({force: true});
    cy.getElementByDataTestsId('node-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M');

    //testing right side
    cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF');
    cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click({force: true});
    cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').eq(0).find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M');

    //check vnf node tree sub header
    cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").should('have.text', 'Created');
    cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").should('have.text', '');
    cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-inMaint']").should('not.exist');

    //check vf Module node tree sub header
    cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-provStatus']").eq(0).should('have.text', 'Prov Status');
    cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-orchStatus']").eq(0).should('have.text', 'Active');
    cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-inMaint']").eq(0).should('have.text', '');

    cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
    cy.getElementByDataTestsId("serviceName").should('have.text', 'mCaNkinstancename');
    cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
    cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'Active');
    cy.getElementByDataTestsId("quantityLabel").should('be.visible');
    cy.getElementByDataTestsId("servicesQuantity").should('have.text', ' 1 ');


  });

  it('check component info for 2 trees for vnf, vf-module, and network', function(){
    initServicePlanning(_VIEW);
    testComponentInfoForVNF();
    testComponentInfoForVFMODULE();
    testComponentInfoForNetwork();
  });

  it(`when open service planning in view mode service instance is shown as expected - e2e with API's ServiceTreeWithMultipleChildren`, function () {
    initServicePlanning(_VIEW);
    /*
    0. title area -> generic stuff
                     instance name
                     orch status
                     service name
    */
    cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
    cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
    cy.getElementByDataTestsId("quantityLabel").should('be.visible');
    cy.getElementByDataTestsId("servicesQuantity").should('have.text', ' 1 ');

    // specific
    cy.getElementByDataTestsId("serviceName").should('have.text', 'SERVICE_INSTANCE_NAME');
    cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'GARBAGE DATA');
    cy.get('span#service-model-name').should('have.text', 'ComplexService');

    // test component info of service-level
    let labelsAndValues = [
      ['Model version', '1.0'],
      ['Instance ID', 'service-instance-id'],
      ['Service type', 'service-instance-type'],
    ];
    cy.assertComponentInfoTitleLabelsAndValues('Service Instance INFO', labelsAndValues);


    // expand all
    cy.get('available-models-tree').find('.toggle-children').click({ multiple: true });

    /*
    1. Left tree -> VNF with 3 vf modules
                    Network
                    Configuration
    */
    const leftShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
      'node-VF_vGeraldine 0': {
        'node-type-indicator': 'VNF',
        'node-name': 'VF_vGeraldine 0',
        'numberButton': '1',
      },
      'node-vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0': {
        'node-type-indicator': 'M',
        'node-name': 'vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0',
        'numberButton': '',
      },
      'node-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1': {
        'node-type-indicator': 'M',
        'node-name': 'vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1',
        'numberButton': '1',
      },
      'node-vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2': {
        'node-type-indicator': 'M',
        'node-name': 'vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2',
        'numberButton': '',
      },
      'node-ExtVL 0': {
        'node-type-indicator': 'N',
        'node-name': 'ExtVL 0',
        'numberButton': '2',
      },
      'node-Port Mirroring Configuration By Policy 0': {
        'node-type-indicator': 'C',
        'node-name': 'Port Mirroring Configuration By Policy 0',
        'numberButton': '',
      },
    };

    for (let node in leftShouldHaves) {
      for (let span in leftShouldHaves[node]) {
        const expected = leftShouldHaves[node][span];
        cy.getElementByDataTestsId(node).find(`[data-tests-id='${span}']`).should(expected ? 'have.text' : 'not.exist', expected);
      }
    }

    /*
    2. Right tree -> VNF with 2 vf modules
                     2 networks
                     IGNORE, don't check: first node, which have no Service connection
    */
    const rightShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
      'node-d6557200-ecf2-4641-8094-5393ae3aae60-VF_vGeraldine 0:0': {
        'node-type-indicator': 'VNF',
        'node-name': 'VNF2_INSTANCE_NAME',
        'status-property-orchStatus': '',
        'status-property-provStatus': '',
        'status-property-inMaint': '',
      },
      'node-undefined-dc229cd8-c132-4455-8517-5c1787c18b14:0': {
        'node-type-indicator': 'M',
        'node-name': 'ss820f_0918_base',
        'status-property-orchStatus': 'Assigned',
        'status-property-provStatus': '',
      },
      'node-522159d5-d6e0-4c2a-aa44-5a542a12a830-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1:0': {
        'node-type-indicator': 'M',
        'node-name': 'ss820f_0918_db',
        'status-property-orchStatus': 'deleted',
        'status-property-provStatus': '',
        'status-property-inMaint': '',
      },
      'node-ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0:0': {
        'node-type-indicator': 'N',
        'node-name': 'NETWORK3_INSTANCE_NAME',
        'status-property-orchStatus': 'Assigned',
        'status-property-provStatus': 'nvtprov',
      },
      'node-ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0:1': {
        'node-type-indicator': 'N',
        'node-name': 'NETWORK4_INSTANCE_NAME',
        'status-property-orchStatus': 'Created',
        'status-property-provStatus': 'preprov',
      },
    };

    for (let node in rightShouldHaves) {
      var [nodeName, nodeEq] = node.split(":");
      for (let span in rightShouldHaves[node]) {
        cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id='${span}']`).should('have.text', rightShouldHaves[node][span]);
      }
    }

    /*
    3. Left to right connections ->
                    vnf: # of instances = 1, click -> vnf selected
                    vf module1: # of instances = 1, click -> 1 vfmodule "ss820f_0918_db" selected
                    vf module2: # of instances = 0, click -> nothing
                    vf module3: # of instances = 0, click -> nothing
                    network: # of instances = 2, click -> 2 networks selected
                    configuration: # of instances = 0, click -> nothing
    */
    const leftShouldHighlight: { [text: string]: string[] } = {
      'VF_vGeraldine 0': ['VNF2_INSTANCE_NAME'],
      'vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0': [],
      'vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1': ['ss820f_0918_db'],
      'vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2': [],
      'ExtVL 0': ['NETWORK3_INSTANCE_NAME', 'NETWORK4_INSTANCE_NAME'],
      'Port Mirroring Configuration By Policy 0': [],
    };

    for (let text in leftShouldHighlight) {
      cy.get('available-models-tree').contains(text).click();

      cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', text + leftShouldHighlight[text].join(''));
    }

    /*
    4. Right to left connections ->
                    vnf: click -> vnf selected
                    vf module1: click -> nothing
                    vf module2: click -> vemme0 selected
                    network1: click -> network selected
                    network2: click -> network selected
     */
    const rightShouldHighlight: { [text: string]: string[] } = {
      'VNF2_INSTANCE_NAME': ['VF_vGeraldine 0'],
      'ss820f_0918_base': [],
      'ss820f_0918_db': ['vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1'],
      'NETWORK3_INSTANCE_NAME': ['ExtVL 0'],
      'NETWORK4_INSTANCE_NAME': ['ExtVL 0'],
    };

    for (let node in rightShouldHighlight) {
      cy.get('drawing-board-tree').contains(node).click();
      cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', rightShouldHighlight[node].join('') + node);
    }
    cy.getElementByDataTestsId('isViewOnly-status-test').contains('VIEW ONLY');


    /*
      5. Click outside should remove highlight from all trees.
     */

    cy.clickOutside('search-left-tree-input', ()=>{
      cy.get('.node-content-wrapper-active.node-content-wrapper-focused').should('have.length', 2)
    },  ()=>{
      cy.get('.node-content-wrapper-active.node-content-wrapper-focused').should('have.length', 0);
    });


  });

  function testComponentInfoForVNF(){
    const labelsAndValuesForModel = [
      ['Model version', '2.0'],
      ['Model customization ID', '91415b44-753d-494c-926a-456a9172bbb9'],
      ['Min instances', '0'],
      ['Max instances', '1']
    ];
    const extraLabelsAndValuesForInstance = [['Instance type', 'VNF2_INSTANCE_TYPE'],['In maintenance','true'], ['Instance ID', 'VNF2_INSTANCE_ID']];
    testComponentInfoByType('node-VF_vGeraldine 0', labelsAndValuesForModel,'VNF INFO',
      'VNF2_INSTANCE_NAME', extraLabelsAndValuesForInstance,'VNF Instance INFO');

  }

  function testComponentInfoForVFMODULE(){
    const labelsAndValuesForModel = [
      ['Model version', '2'],
      ['Model customization ID', '55b1be94-671a-403e-a26c-667e9c47d091'],
      ['Base module', 'false'],
      ['Min instances', '0'],
      ['Initial instances count', '0']
    ];
    const extraLabelsAndValuesForInstance = [['In maintenance','true'], ['Instance ID', '2c1ca484-cbc2-408b-ab86-25a2c15ce280']];
    testComponentInfoByType('node-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1',labelsAndValuesForModel,'VFModule INFO',
      'ss820f_0918_db',extraLabelsAndValuesForInstance,'VFModule Instance INFO')

  }

  function testComponentInfoForNetwork(){
    const labelsAndValuesForModel = [
      ['Model version', '37.0'],
      ['Model customization ID', '94fdd893-4a36-4d70-b16a-ec29c54c184f'],
      ['Network role','network role 1, network role 2']
    ];
    const extraLabelsAndValuesForInstance = [['In maintenance','false'], ['Instance ID', 'NETWORK3_INSTANCE_ID'],['Instance type', 'CONTRAIL30_BASIC']];
    testComponentInfoByType('node-ExtVL 0',labelsAndValuesForModel,'Network INFO',
      'NETWORK3_INSTANCE_NAME',extraLabelsAndValuesForInstance,'Network Instance INFO');

  }

  function testComponentInfoByType(leftNode:string, labelsAndValuesForModel: string[][], expectedTitleForModel:string, rightNode:string, extraLabelsAndValuesForInstance: string[][], expectedTitleForInstance:string){
    cy.getElementByDataTestsId(leftNode).eq(0).click({force: true});
    cy.assertComponentInfoTitleLabelsAndValues(expectedTitleForModel, labelsAndValuesForModel);

    let labelsAndValuesForInstance = labelsAndValuesForModel.concat(extraLabelsAndValuesForInstance);
    cy.get('drawing-board-tree').contains(rightNode).click();
    cy.assertComponentInfoTitleLabelsAndValues(expectedTitleForInstance, labelsAndValuesForInstance);
  }


});
