package cz.moneta.test.dsl.szrmock;

import cz.moneta.test.dsl.util.DateUtils;
import cz.moneta.test.dsl.util.TestUtils;

public class SzrMockPayload {
    public String getPayloadE278Slash5(SzrMockData data) {
        String birthDate = DateUtils.convertRawDateForWso2(TestUtils.dateFromString(data.getClient().birthDate(), "d.M.yyyy"));
        return
                "{\n" +
                        "    \"apiName\": \"/api/v1/external/szr/278/robctipodleudaju2\",\n" +
                        "    \"notes\": \"E278/5\",\n" +
                        "    \"request\": {\n" +
                        "        \"birthDate\": \"" + birthDate + "\",\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"firstName\": \"" + data.getClient().firstName() + "\",\n" +
                        "        \"idNumber\": \"" + data.getClient().idCardNumber() + "\",\n" +
                        "        \"idType\": \"" + data.getIdType1() + "\",\n" +
                        "        \"lastName\": \"" + data.getClient().lastName() + "\",\n" +
                        "        \"nationality\": \"" + data.getNationality() + "\"\n" +
                        "    },\n" +
                        "    \"response\": {\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\",\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"firstName\": {\n" +
                        "            \"correct\": \"true\",\n" +
                        "            \"value\": \"" + data.getClient().firstName() + "\"\n" +
                        "        },\n" +
                        "        \"lastName\": {\n" +
                        "            \"correct\": \"true\",\n" +
                        "            \"value\": \"" + data.getClient().lastName() + "\"\n" +
                        "        },\n" +
                        "        \"birthDate\": {\n" +
                        "            \"correct\": \"true\",\n" +
                        "            \"value\": \"" + birthDate + "\"\n" +
                        "        },\n" +
                        "        \"ids\": [\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"" + data.getIdType1() + "\"\n" +
                        "                },\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getClient().idCardNumber() + "\"\n" +
                        "                }\n" +
                        "            },\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"" + data.getIdType2() + "\"\n" +
                        "                },\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getClient().passportId() + "\"\n" +
                        "                }\n" +
                        "            }\n" +
                        "        ],\n" +
                        "        \"livingPlace\": {\n" +
                        "            \"correct\": \"" + data.getLivingPlaceTf() + "\",\n" +
                        "            \"value\": \"" + data.getLivingPlaceNumber() + "\"\n" +
                        "        },\n" +
                        "        \"birthPlace\": {\n" +
                        "            \"correct\": \"true\",\n" +
                        "            \"value\": \"" + data.getBirthplace() + "\"\n" +
                        "        },\n" +
                        "        \"citizenships\": [\n" +
                        "            {\n" +
                        "                \"correct\": true,\n" +
                        "                \"value\": \"" + data.getCitizenShips() + "\"\n" +
                        "            }\n" +
                        "        ],\n" +
                        "        \"dataBox\": {\n" +
                        "            \"correct\": \"" + data.getDataBoxTf() + "\",\n" +
                        "            \"value\": \"" + data.getDataBox() + "\"\n" +
                        "        },\n" +
                        "        \"deathDate\": {\n" +
                        "            \"correct\": \"" + data.getDeathDateTf() + "\",\n" +
                        "            \"value\": \"" + data.getDeathDate() + "\"\n" +
                        "        },\n" +
                        "        \"subscriptionState\": {\n" +
                        "            \"correct\": \"\",\n" +
                        "            \"value\": \"\"\n" +
                        "        },\n" +
                        "        \"alreadyExists\": \"true\"\n" +
                        "    }\n" +
                        "}";
    }

    public String getPayloadE171(SzrMockData data) {
        return
                "{\n" +
                        "    \"apiName\": \"/api/v1/external/szr/171/aiseoctiaifo2\",\n" +
                        "    \"notes\": \"Chovy E171\",\n" +
                        "    \"request\": {\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\"\n" +
                        "    },\n" +
                        "    \"response\": {\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\",\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"givenName\": \"" + data.getGivenName() + "\",\n" +
                        "        \"gender\": \"" + data.getGender() + "\",\n" +
                        "        \"birthDistrict\": {\n" +
                        "            \"birthDistrictCode\": \"" + data.getBirthDistrictCode() + "\",\n" +
                        "            \"birthDistrictName\": \"" + data.getBirthDistrictName() + "\",\n" +
                        "            \"birthDistrictCodeCsu\": \"" + data.getBirthDistrictCodeCsu() + "\"\n" +
                        "        },\n" +
                        "        \"birthCity\": {\n" +
                        "            \"birthCityCode\": \"" + data.getBirthCityCode() + "\",\n" +
                        "            \"birthCityName\": \"" + data.getBirthCityName() + "\",\n" +
                        "            \"birthCityCodeCsu\": \"" + data.getBirthCityCodeCsu() + "\"\n" +
                        "        },\n" +
                        "        \"birthState\": {\n" +
                        "            \"birthStateCode\": \"" + data.getBirthState() + "\",\n" +
                        "            \"birthStateName\": \"" + data.getBirthStateName() + "\",\n" +
                        "            \"birthStateCodeCsu\": \"" + data.getNationality() + "\"\n" +
                        "        },\n" +
                        "        \"birthNumber\": \"" + data.getClient().birthNumber() + "\",\n" +
                        "        \"legalCapacity\": \"" + data.getLegalCapacity() + "\",\n" +
                        "        \"deathDateOfficial\": \"\"\n" +
                        "    }\n" +
                        "}";
    }

    public String getPayloadE173(SzrMockData data) {
        return
                "{\n" +
                        "    \"apiName\": \"/api/v1/external/szr/173/aiscctiaifo2\",\n" +
                        "    \"notes\": \"" + data.getNotes() + "\",\n" +
                        "    \"request\": {\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\"\n" +
                        "    },\n" +
                        "    \"response\": {\n" +
                        "        \"authorizationValidityFrom\": \"" + data.getAuthorizationValidityFrom() + "\",\n" +
                        "        \"authorizationValidityNumber\": \"" + data.getClient().idCardNumber() + "\",\n" +
                        "        \"authorizationValidityTo\": \"" + data.getAuthorizationValidityTo() + "\",\n" +
                        "        \"birthCity\": {\n" +
                        "            \"birthCityCode\": \"\",\n" +
                        "            \"birthCityCodeCsu\": \"\",\n" +
                        "            \"birthCityName\": \"" + data.getBirthplace() + "\"\n" +
                        "        },\n" +
                        "        \"birthDate\": \"\",\n" +
                        "        \"birthNumber\": \"" + data.getClient().birthNumber() + "\",\n" +
                        "        \"birthState\": {\n" +
                        "            \"birthStateCode\": \"" + data.getCitizenShips() + "\",\n" +
                        "            \"birthStateCodeCsu\": \"" + data.getCitizenShips() + "\",\n" +
                        "            \"birthStateName\": \"" + data.getBirthStateName() + "\"\n" +
                        "        },\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"deathDate\": \"\",\n" +
                        "        \"firstName\": \"" + data.getClient().firstName() + "\",\n" +
                        "        \"gender\": \"" + data.getGender() + "\",\n" +
                        "        \"lastName\": \"" + data.getClient().lastName() + "\",\n" +
                        "        \"legalCapacity\": \"" + data.getLegalCapacity() + "\",\n" +
                        "        \"otherNames\": \"\",\n" +
                        "        \"residenceType\": \"" + data.getResidenceType() + "\",\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\"\n" +
                        "    }\n" +
                        "}";
    }

    public String getPayloadE188(SzrMockData data) {
        return
                "{\n" +
                        "    \"apiName\": \"/api/v1/external/szr/188/eopctiaifo\",\n" +
                        "    \"notes\": \"Poznamka\",\n" +
                        "    \"request\": {\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\"\n" +
                        "    },\n" +
                        "    \"response\": {\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\",\n" +
                        "        \"ids\": [\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"" + data.getIdType1() + "\"\n" +
                        "                },\n" +
                        "                \"status\": \"\",\n" +
                        "                \"expiryDate\": \"" + data.getExpiryDate1() + "\",\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getClient().idCardNumber() + "\"\n" +
                        "                },\n" +
                        "                \"issuer\": \"" + data.getIssuer() + "\",\n" +
                        "                \"issueDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getIssueDate() + "\"\n" +
                        "                },\n" +
                        "                \"expirationDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + DateUtils.convertRawDateForWso2(data.getClient().idCardExpiredRaw()) + "\"\n" +
                        "                }\n" +
                        "            },\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"" + data.getIdType2() + "\"\n" +
                        "                },\n" +
                        "                \"status\": \"\",\n" +
                        "                \"expiryDate\": \"" + data.getExpiryDate2() + "\",\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"222000000\"\n" +
                        "                },\n" +
                        "                \"issuer\": \"" + data.getIssuer() + "\",\n" +
                        "                \"issueDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getIssueDate() + "\"\n" +
                        "                },\n" +
                        "                \"expirationDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + DateUtils.convertRawDateForWso2(data.getClient().passportExpiryDateRaw()) + "\"\n" +
                        "                }\n" +
                        "            }\n" +
                        "        ]\n" +
                        "    }\n" +
                        "}";
    }

    public String getPayloadE189(SzrMockData data) {
        return
                "{\n" +
                        "    \"apiName\": \"/api/v1/external/szr/189/ecdctiaifo\",\n" +
                        "    \"notes\": \"Poznamka\",\n" +
                        "    \"request\": {\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\"\n" +
                        "    },\n" +
                        "    \"response\": {\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\",\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"fds\": [\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"Cestovní pas\"\n" +
                        "                },\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getClient().passportId() + "\"\n" +
                        "                },\n" +
                        "                \"issuer\": \"" + data.getIssuer() + "\",\n" +
                        "                \"issueDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getIssueDate() + "\"\n" +
                        "                },\n" +
                        "                \"expirationDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getExpirationDateP1() + "\"\n" +
                        "                }\n" +
                        "            },\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"Cestovní průkaz\"\n" +
                        "                },\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"1241000\"\n" +
                        "                },\n" +
                        "                \"issuer\": \"\",\n" +
                        "                \"issueDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"2019-03-01\"\n" +
                        "                },\n" +
                        "                \"expirationDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getExpirationDateP2() + "\"\n" +
                        "                }\n" +
                        "            },\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"Cestovní pas\"\n" +
                        "                },\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getClient().passportId() + "\"\n" +
                        "                },\n" +
                        "                \"issuer\": \"Říčany\",\n" +
                        "                \"issueDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"2016-04-04\"\n" +
                        "                },\n" +
                        "                \"expirationDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"" + data.getExpirationDateP3() + "\"\n" +
                        "                }\n" +
                        "            },\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"Cestovní pas\"\n" +
                        "                },\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"34545454\"\n" +
                        "                },\n" +
                        "                \"issuer\": \"Blovice\",\n" +
                        "                \"issueDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"2015-01-01\"\n" +
                        "                },\n" +
                        "                \"expirationDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"2021-01-01\"\n" +
                        "                }\n" +
                        "            },\n" +
                        "            {\n" +
                        "                \"type\": {\n" +
                        "                    \"correct\": true,\n" +
                        "                    \"value\": \"Cestovní pas\"\n" +
                        "                },\n" +
                        "                \"number\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"8898989\"\n" +
                        "                },\n" +
                        "                \"issuer\": \"Česká Třebová\",\n" +
                        "                \"issueDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"2002-01-01\"\n" +
                        "                },\n" +
                        "                \"expirationDate\": {\n" +
                        "                    \"correct\": \"true\",\n" +
                        "                    \"value\": \"2020-01-01\"\n" +
                        "                }\n" +
                        "            }\n" +
                        "        ]\n" +
                        "    }\n" +
                        "}";
    }

    public String getPayloadE45(SzrMockData data) {
        return
                "{\n" +
                        "    \"apiName\": \"/api/v1/external/szr/45/orgprihlasaifo\",\n" +
                        "    \"notes\": \"Chovy E45\",\n" +
                        "    \"request\": {\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\"\n" +
                        "    },\n" +
                        "    \"response\": {\n" +
                        "        \"szrId\": \"" + data.getSzrId() + "\",\n" +
                        "        \"busCode\": \"" + data.getBusCode() + "\",\n" +
                        "        \"status\": \"OK\"\n" +
                        "    }\n" +
                        "}";
    }
}
