package cz.moneta.test.dsl.cagw.api.v1.external.product.cloan.application;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Client {
    private String firstname;
    private String lastname;
    private String birthNumber;
    private ProofOfIdentity primaryProofOfIdentity;
    private ProofOfIdentity secondaryProofOfIdentity;
    private String nationality;
    private Address contactAddress;
    private Address permanentAddress;
    private Integer currentAddressSinceYear;
    private String phoneNumber;
    private String email;
    private String maritalStatus;
    private String restrictedJoinedAssets;
    private String accommodationType;
    private String educationLevel;
    private Occupation occupation;
    private Consents consents;
    private String familyBusiness;
    private String familyBusinessPercentage;
    private Integer netMonthlyIncome;
    private Integer homeIncome;
    private String incomeTaxBase;
    private Integer grossIncome;
    private String tax;
    private String taxableYear;
    private Integer dependentPersons;
    private Integer otherLoanPayments;
    private Integer wageDeductions;
    private Integer otherExpenses;

    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Data
    public static class ProofOfIdentity {
        private String type;
        private String number;
        //FIXME correct date pattern
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "CET")
        private Date expirationDate;
        private String issuingCountry;
    }

    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Data
    public static class Occupation {
        private String status;
        private Integer code;
        private Institution institution;
        private String employmentFrom;
        private String employmentTo;
        private Boolean trialPeriod;
        private Boolean onNotice;
    }

    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Data
    public static class Institution {
        private String name;
        private String ico;
        private String phoneNumber;
        private Address address;
    }

    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Data
    public static class Consents {
        private Boolean dataProcessing;
        private Boolean debtRegisterCheck;
    }
}
