///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
import {AaiServiceInstancesModel} from '../../support/jsonBuilders/models/serviceInstances.model';
import {AAISubDetailsModel} from '../../support/jsonBuilders/models/aaiSubDetails.model';
import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewEdit.model';

describe('Soft delete tests', function () {
  describe('basic UI tests', () => {

    var jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
    var jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>();
    var jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>();
    var jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>();
    beforeEach(() => {
      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => {
        jsonBuilderAAIService.basicJson(
          res,
          Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44",
          200, 0,
          "service-complexService",
          changeServiceModel)
      });


      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForServiceWithSomeVFModule.json').then((res) => {
        jsonBuilderAAISubViewEditModel.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/3f93c7cb-2fd0-4557-9514-e189b7b04f9d",
          200,
          0,
          "aai-sub-view-edit")
      });

      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => {
        jsonBuilderAAISubDetailsModel.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_sub_details/**",
          200,
          0,
          "aai-sub-details")
      });

      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => {
        jsonBuilderAaiServiceInstances.basicJson(
          res,
          Cypress.config('baseUrl') + "/search_service_instances**",
          200,
          0,
          "aai-get-service-instances")
      });

      cy.initVidMock();

      cy.initTenants();

      cy.login();
    });

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

    it(`Soft delete button will be display also if base module is true`, function () {
      cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
      cy.wait('@service-complexService');
      checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true);
    });

    it(`Soft delete button not display in assigned orch status`, function () {
      cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
      cy.wait('@service-complexService');
      checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
    });

    it(`Resume button display in orch status - pendingactivation, assigned - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is OFF`, function () {

      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then(() => {
        cy.server()
          .route({
            method: 'GET',
            delay :  0,
            status :  200,
            url : Cypress.config('baseUrl') + "/flags**",
            response : {
              "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false
            }
          }).as('initFlags');
      });

      cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
      cy.wait('@service-complexService');

      checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation');
      checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned');

      cy.get('.vfModuleTreeNode-created')
        .getElementByDataTestsId('resumeVFModuleButton-ABC').should('not.be.visible');
      cy.get('.vfModuleTreeNode-pending-delete')
        .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible');

    });

    it(`Resume button display in orch status - pendingactivation, assigned, created - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is ON`, function () {

      cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
      cy.wait('@service-complexService');

      checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation');
      checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned');
      checkResumeAndPopup('ABC', 'vfModuleTreeNode-created');

      cy.get('.vfModuleTreeNode-pending-delete')
        .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible');

    });

    it(`Delete popup with not homing data from AAI`, function () {
      cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
      cy.wait('@service-complexService');
      checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
      cy.selectDropdownOptionByText('lcpRegion', 'AAIAIC25 (AIC)');
      cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
      cy.typeToInput("lcpRegionText", "just another region");
      cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
      cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01');
      cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled');
      cy.selectDropdownOptionByText('lcpRegion', 'hvf6 (AIC)');
      cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
      cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
      cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled');
      cy.getElementByDataTestsId('cancel').click({force: true});
      cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.be.visible');
    });

    it(`Soft delete button display with partial homing data from AAI`, function () {

      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiGetHomingData.json').then((res) => {
        jsonBuilderAaiServiceInstances.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/c015cc0f-0f37-4488-aabf-53795fd93cd3/a231a99c-7e75-4d6d-a0fb-5c7d26f30f77",
          200,
          0,
          "aai-get-homing-data")
      });


      cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
      cy.wait('@service-complexService');
      checkSoftDeleteAndDeletePopup('my_vfModule', 'vfModuleTreeNode-pending-delete', true, true);
      cy.getElementByDataTestsId('lcpRegionText').should('be.visible');
      cy.getElementByDataTestsId('lcpRegion').contains('AAIAIC25');
      cy.getElementByDataTestsId('tenant').contains('USP-SIP-IC-24335-T-01');
    });

    it(`Soft delete button display with with homing data from AAI`, function () {

      cy.readFile('../vid-automation/src/test/resources/viewEdit/aaiHomingDataResponse.json').then((res) => {
        jsonBuilderAaiServiceInstances.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/0846287b-65bf-45a6-88f6-6a1af4149fac/a9b70ac0-5917-4203-a308-0e6920e6d09b",
          200,
          0,
          "aai-get-homing-data")
      });

      cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
      cy.wait('@service-complexService');
      checkSoftDeleteAndDeletePopup('vf_module2', 'vfModuleTreeNode-pendingcreate', true, false);
    });

    it(`Soft delete and Delete - Mega region is AAIAIC25 - not 'olson3', 'olson5a'`, function () {
      cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
      cy.wait('@service-complexService');
      //Delete
      checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
      checkLegacyRegion();
      cy.getElementByDataTestsId('cancel').click();
      //Soft delete
      checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true);
      checkLegacyRegion();
      cy.getElementByDataTestsId('cancel').click();
      //Resume
      cy.get('div').find('.vfModuleTreeNode-pendingactivation')
        .getElementByDataTestsId('resumeVFModuleButton-aa').click().then(()=> {
        checkLegacyRegion();
      });
    });

    function checkLegacyRegion() {
      checkIsLegacyRegionTextIsDisplay('AAIAIC25 (AIC)', true);
      checkIsLegacyRegionTextIsDisplay('olson3 (AIC)', false);
      checkIsLegacyRegionTextIsDisplay('olson5a (AIC)', false);
      checkIsLegacyRegionTextIsDisplay('hvf6 (AIC)', false);
    }

    function checkIsLegacyRegionTextIsDisplay(lcpRegionName: string, isVisible: boolean) {
      const isVisibleText = isVisible ? 'be.visible' : 'not.be.visible';
      cy.selectDropdownOptionByText('lcpRegion', lcpRegionName);
      cy.getElementByDataTestsId('lcpRegionText').should(isVisibleText);

    }

    function checkResumeAndPopup(vfModuleName:string, vfModuleClassName:string)  {
      cy.get('div').find('.' + vfModuleClassName)
        .getElementByDataTestsId('resumeVFModuleButton-' + vfModuleName).click().then(()=> {
        cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
          .getElementByDataTestsId('softDeleteButton').should('not.be.visible')
          .getElementByDataTestsId('lcpRegion').should('be.visible')
          .getElementByDataTestsId('tenant').should('be.visible')
          .getElementByDataTestsId('modalTitle').contains('Instantiate')
          .getElementByDataTestsId('confirmResumeDeleteButton').contains('Instantiate')
          .getElementByDataTestsId('cancel').click();
      });
    }

    function checkSoftDeleteAndDeletePopup(vfModuleName:string, vfModuleClassName:string, softDeleteEnable:boolean, isNoHomingData:boolean)  {
      const visibleString = 'be.visible';
      const NOT = 'not.';
      const softDeleteVisibleString = (softDeleteEnable) ? visibleString : NOT + visibleString;
      const isNoHomingDataVisibleString = (isNoHomingData) ? visibleString : NOT + visibleString;
      cy.get('div').find('.' + vfModuleClassName)
        .getElementByDataTestsId('deleteVFModuleButton-' + vfModuleName).click({force: true}).then(()=> {
        cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
          .getElementByDataTestsId('softDeleteButton').should(softDeleteVisibleString)
          .getElementByDataTestsId('lcpRegion').should(isNoHomingDataVisibleString)
          .getElementByDataTestsId('tenant').should(isNoHomingDataVisibleString);
      });
    }
  });



  function changeServiceModel(serviceModel: ServiceModel) {
    serviceModel.service.uuid = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
    return serviceModel;
  }
});

