package cz.moneta.test.dsl.util.task.brokerportal;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.brokerportal.enums.Client;
import cz.moneta.test.harness.support.data.GeneratorType;

import java.time.LocalDate;

public class CommonTasks {

    private static final String[] ID_CARDS = new String[]{
            "209498399", "210453438", "209924849", "209421549"
    };

    private final Harness harness;

    public CommonTasks(Harness harness) {
        this.harness = harness;
    }

    public String getMobilePhoneNumber() {
        return "+420" + harness.generate(GeneratorType.MOBILE_PHONE_NUMBER);
    }

    public String getIdentityCard(String client) {
        return ID_CARDS[Integer.parseInt(client)];
    }

    public String getPassportNumber() {
        return harness.generate(GeneratorType.PASSPORT_NUMBER, LocalDate.of(1988, 1, 6));
    }

    public String getCurrentYearIncrementedByYears(int years) {
        return String.valueOf(LocalDate.now().plusYears(years).getYear());
    }

    public String getSmsCode() {
        return "123456";
    }

    public String birthNumberForClient(Client client) {
        return "PERSONAL_ID" + "_" + client.getValue();
    }
}