///<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';

describe('search existing instance', function () {
  var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();

  beforeEach(() => {
    cy.window().then((win) => {
      win.sessionStorage.clear();
      cy.preventErrorsOnLoading();
      cy.initAAIMock();
      cy.initVidMock();
      cy.initZones();
      cy.permissionVidMock();
      cy.login();
    });
  });

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

  it('when find instance with resource group in the model then open new service planning in edit mode', function () {
    const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
    const SUBSCRIBER_NAME:string ="SILVIA ROBBINS";
    const SERVICE_TYPE: string = "VIRTUALUSP";
    const SERVICE_INSTANCE_ID: string = "3d930d51-eed8-41b8-956f-70aa0d19940b";
    const SERVICE_MODEL_VERSION_ID: string = '5aece664-e92d-4a99-8a76-c7d7b8d23d09';
    const SERVICE_MODEL_INVARIANT_ID: string = 'd089c740-53ac-41f6-8e5b-32e862302ef1';

    var searchServiceInstancesResponse = {
      "service-instances": [{
        "serviceInstanceId":SERVICE_INSTANCE_ID,
        "globalCustomerId": SUBSCRIBER_ID,
        "serviceType": SERVICE_TYPE,
        "serviceInstanceName": "abc_mdns_2017_1011_IST_Service_CSI",
        "subscriberName": SUBSCRIBER_NAME,
        "aaiModelInvariantId": SERVICE_MODEL_INVARIANT_ID,
        "aaiModelVersionId": SERVICE_MODEL_VERSION_ID,
        "isPermitted": true
      }
      ]
    };

    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.server()
      .route({
        method: 'GET',
        status: 200,
        delay : 0,
        url: Cypress.config('baseUrl') + `/search_service_instances?subscriberId=${SUBSCRIBER_ID}&serviceInstanceIdentifier=${SERVICE_INSTANCE_ID}`,
        response: searchServiceInstancesResponse
      }).as('search_service_instances');

    cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/serviceForNewViewEdit.json').then((res) => {
      jsonBuilderAndMock.basicJson(
        res,
        Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_VERSION_ID}`,
        200,
        0,
        "serviceForNewViewEdit",
        (res: ServiceModel)=>{
          res.service.uuid = SERVICE_MODEL_VERSION_ID;
          res.service.invariantUuid =SERVICE_MODEL_INVARIANT_ID;
          return res;
        }
      )
    });

    cy.visit(`/serviceModels.htm#/instances/subdetails?subscriberId=${SUBSCRIBER_ID}&serviceInstanceIdentifier=${SERVICE_INSTANCE_ID}`);
    cy.getElementByDataTestsId(`view/edit-test-data-id-${SERVICE_INSTANCE_ID}`).click();
    cy.url().should('contains',`servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_VERSION_ID}&subscriberId=${SUBSCRIBER_ID}`+
      `&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
  });

});

