/**
 * BaaSCaradhrasAPIDocumentationLib
 *
 * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
 */

'use strict';

const chai = require('chai');
const assert = chai.assert;
const TestHelper = require("../TestHelper");
const APIHelper = require("../../lib/APIHelper");
const testerlib = require("../../lib");
const testConfiguration = require("../TestBootstrap");

const controller = testerlib.KYCController;
const MKnowyourclientPeople = testerlib.MKnowyourclientPeople;

describe("KYCController Tests", function tests() {
    this.timeout(testConfiguration.TEST_TIMEOUT);

    /**
     * <p>This method allows to retrieve dates of a determined Physical Person existent using name or document.</p>
<p>"resources" returns: </p>
<table>
   <tr>
     <th>Resources</th>
     <th>Description</th>
   </tr>
   <tr>
     <td>1</td>
     <td>Dados básicos</td>
      </tr>
   <tr>
     <td>2</td>
     <td>Sanções</td>
   </tr>
   <tr>
     <td>3</td>
     <td>Creditício (presença em cobrança)</td>
   </tr>
   <tr>
     <td>4</td>
     <td>Creditício (Score SPC)</td>
   </tr>
</table>


<p>"IsCurrentlyPEP" returns:</p>
<table>
   <tr>
     <th>Resources</th>
     <th>Description</th>
   </tr>
   <tr>
     <td>true</td>
     <td>The "SanctionsHistory" information is about the "Name" (Physical Person searched) </td>
      </tr>
   <tr>
     <td>false</td>
     <td>The "SanctionsHistory" information is about a person whose name is similar to "Name" (Physical Person searched), so you can ignore this information.</td>
   </tr>
   <tr>
</tr></table>
     */
    it("should testMKnowyourclientPeople response", function testMKnowyourclientPeopleTest(done) {
        // parameters for the API call
        let contentType = 'application/json';
        let authorization = '{{tokenCaradhrasDev}}';
        let body = '{\n    "document": "12345678", \n    Add CPF\'s number \n    "resources": [1, 2, 3, 4]\n}';

        controller.createKnowyourclientPeople(contentType, authorization, body, function callback(error, response, context) {
            // test response code
            assert.equal(200, context.response.statusCode);
            assert.isNotNull(response);
            assert.isTrue(TestHelper.isProperSubsetOf(context.response.body, {
  "BasicData": {
    "TaxIdNumber": "12345678",
    "Name": "Mr. Khalil McLaughlin",
    "Gender": "M",
    "BirthDate": "1970-01-11T00: 00: 00Z",
    "ZodiacSign": "TOURO",
    "MotherName": "Ms. Kavon Ledner"
  },
  "Addresses": [
    {
      "Typology": "Avenida",
      "Title": "",
      "AddressMain": "662 Garrison Village",
      "Number": 222,
      "Complement": "Suite 111",
      "Neighborhood": "ENSEADA",
      "ZipCode": "77220-3016",
      "City": "Milanport",
      "State": "Colorado",
      "Country": "Samoa",
      "Type": "HOME"
    }
  ],
  "Phones": [
    {
      "Number": 34442094,
      "AreaCode": 47,
      "CountryCode": 55
    }
  ],
  "Sanctions": {
    "PEPHistory": [],
    "IsCurrentlyPEP": false,
    "SanctionsHistory": [
      {
        "Source": "interpol",
        "Type": "Law Enforcement",
        "MatchRate": 53,
        "NameUniquenessScore": 0.99,
        "Details": {
          "OriginalName": "ANTONIO DA SILVA SILVA",
          "SanctionName": "ANTONIO ANGLES MARTINS",
          "Nationalities": "SPAIN",
          "language_spoken": "spanish, portuguese",
          "height": "1.75 meter",
          "eyes_color": "blue",
          "charges": "delitos rapto, violación, asesinato, inhumación de cadáver y tenencia ilícita de armas.",
          "image": "http: //www.interpol.int/var/interpol/cache/ws/1993-9069/wanted-getpicture-52341566.jpg;http: //www.interpol.int/var/interpol/cache/ws/1993-9069/wanted-GetPicture-52341565.jpg"
        },
        "StartDate": "0001-01-01T00: 00: 00",
        "EndDate": "9999-12-31T23: 59: 59.9999999",
        "CreationDate": "2019-03-06T07: 12: 25.526Z",
        "LastUpdateDate": "0001-01-01T00: 00: 00"
      },
      {
        "Source": "interpol",
        "Type": "Law Enforcement",
        "MatchRate": 52,
        "NameUniquenessScore": 0.99,
        "Details": {
          "OriginalName": "ANTONIO DA SILVA SILVA",
          "SanctionName": "ANTONIO RUIZ VARELA",
          "Nationalities": "HONDURAS",
          "language_spoken": "spanish",
          "height": "1.68 meter",
          "hair_color": "black",
          "eyes_color": "brown",
          "charges": "1) conspiracy to possess unregistered firearms\n2) possessing and receiving firearms and ammunition as an illegal alien",
          "image": "http: //www.interpol.int/var/interpol/cache/ws/2010-13216/wanted-getpicture-57019581.jpg"
        },
        "StartDate": "0001-01-01T00: 00: 00",
        "EndDate": "9999-12-31T23: 59: 59.9999999",
        "CreationDate": "2019-03-06T07: 06: 18.325Z",
        "LastUpdateDate": "0001-01-01T00: 00: 00"
      },
      {
        "Source": "interpol",
        "Type": "Law Enforcement",
        "MatchRate": 51,
        "NameUniquenessScore": 0.99,
        "Details": {
          "OriginalName": "ANTONIO DA SILVA SILVA",
          "SanctionName": "ANTONIO RIANO",
          "Nationalities": "MEXICO, UNITED STATES",
          "language_spoken": "spanish, english",
          "height": "1.67 meter",
          "hair_color": "black",
          "eyes_color": "brown",
          "charges": "murder with gun",
          "image": "http: //www.interpol.int/var/interpol/cache/ws/2005-10558/wanted-getpicture-53118905.jpg;http: //www.interpol.int/var/interpol/cache/ws/2005-10558/wanted-GetPicture-53118907.jpg"
        },
        "StartDate": "0001-01-01T00: 00: 00",
        "EndDate": "9999-12-31T23: 59: 59.9999999",
        "CreationDate": "2019-03-06T07: 08: 13.513Z",
        "LastUpdateDate": "0001-01-01T00: 00: 00"
      }
    ],
    "IsCurrentlySanctioned": false
  },
  "Collections": {
    "CollectionOccurrences": 7,
    "CollectionOrigins": 2,
    "FirstCollectionDate": "2017-03-26T00: 00: 00Z",
    "LastCollectionDate": "2017-09-13T15: 23: 31Z",
    "CreationDate": "2017-03-26T00: 00: 00Z",
    "LastUpdateDate": "2017-09-13T15: 23: 31Z"
  },
  "Score": {
    "Name": "SCORE 12 MONTHS",
    "Class": "F",
    "Horizon": "12",
    "Probability": "0",
    "Score": "0",
    "ScoreType": "RESTRICTED",
    "Reason": "O DOCUMENTO CONSULTADO APRESENTA REGISTRO(S) DE INADIMPLENCIA.",
    "AdditionalOutputData": {}
  },
  "DocInfo": {},
  "TicketId": "5cc08371293b9d0c488d789a",
  "ResultCode": -111,
  "ResultMessage": "Access denied",
  "Questions": [],
  "OnlineCertificates": [
    {
      "Origin": "PFAntecedente",
      "InputParameters": "doc{xxxxxxxxxxx}",
      "AdditionalOutputData": {
        "IdNumber": "xxxxxxxxxxx",
        "Status": "NADA CONSTA",
        "CertificateNumber": 16021832019,
        "CertificateText": "A Polícia Federal CERTIFICA, após pesquisa no Sistema Nacional de Informações Criminais - SINIC, que até a presente data, NÃO CONSTA decisão judicial condenatória com trânsito em julgado* em nome de VANESSA SUILVA, nascido(a) aos 06/07/1994",
        "EmissionDate": "19: 46 de 11/03/2019",
        "Validity": "90 DAYS"
      },
      "QueryDate": "2019-03-27T19: 28: 22.9234301Z"
    }
  ]
}, false, true, false));
            done();
        }).catch(() => undefined);
    });
});
