package com.qmth.boot.core.retrofit.config;

import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotNull;
import java.time.Duration;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

@Validated
public class RetryProperties {

    @NotNull
    private Integer count = 3;

    @NotNull
    private Duration interval = Duration.ofMillis(300);

    @NotNull
    private Set<Integer> statusCode = new HashSet<>(Arrays.asList(408, 503, 504));

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Duration getInterval() {
        return interval;
    }

    public void setInterval(Duration interval) {
        this.interval = interval;
    }

    public Set<Integer> getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(Set<Integer> statusCode) {
        this.statusCode = statusCode;
    }
}
