package ru.yandex.qe.dispenser.domain.util;

import java.time.LocalDate;
import java.time.Month;
import java.time.format.DateTimeFormatter;

import ru.yandex.qe.dispenser.api.v1.DiQuotaChangeRequest;
import ru.yandex.qe.dispenser.domain.bot.BigOrder;

@Deprecated
public final class BigOrderLegacy {

    private BigOrderLegacy() {
    }

    // See DISPENSER-1569
    // TODO Get rid of isValid
    @Deprecated
    private static final LocalDate VALID_FROM = LocalDate.of(2020, Month.JANUARY, 1);

    @Deprecated
    public static DiQuotaChangeRequest.Order toView(BigOrder bigOrder) {
        return new DiQuotaChangeRequest.Order(bigOrder.getId(), bigOrder.getDate(), checkValid(bigOrder.getDate()));
    }

    @Deprecated
    public static boolean checkValid(String date) {
        final LocalDate parsedDate = LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE);
        return checkValid(parsedDate);
    }

    @Deprecated
    public static boolean checkValid(LocalDate date) {
        return !date.isBefore(VALID_FROM);
    }

}
