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

import cz.moneta.test.dsl.util.data.client.Gender;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.data.GeneratorType;

import java.time.LocalDate;

public class CommonTasks {

    private final StoreAccessor harness;

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

    public String getRcByMaxAge(int maxAge) {
        LocalDate toDate = LocalDate.now();
        return harness.generate(GeneratorType.RC, toDate.minusYears(maxAge), toDate);
    }

    public String getRcMinMaxAge(int minAge, int maxAge) {
        LocalDate toDate = LocalDate.now();
        if (minAge >= maxAge) {
            throw new IllegalStateException("Minimal age has to be lower than max age");
        }
        return harness.generate(GeneratorType.RC, toDate.minusYears(maxAge), toDate.minusYears(minAge));
    }

    public String getWomanRc() {
        return harness.generate(GeneratorType.RC, Gender.WOMAN);
    }

    public String getFakePdfPath() {
        return "regression/ufo/cb/Pdf.pdf";
    }
}