///<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.json').then(() => {
        cy.server()
          .route({
            method: 'GET',
            delay :  0,
            status :  200,
            url : Cypress.config('baseUrl') + "/flags**",
            response : {
              "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE": true,
              "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;
  }
});

