
package dev.sonpx.loyalty.mcp.filter;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * Handle for filtering comparable types with range options
 * Include types: Integer, Long, Float, Double, BigDecimal, Instant, LocalDate
 */
@Getter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class RangeFilter<T extends Comparable<? super T>> extends Filter<T> {

    private T greaterThan;
    private T lessThan;
    private T greaterThanOrEqual;
    private T lessThanOrEqual;

    public RangeFilter(RangeFilter<T> filter) {
        super(filter);
        this.greaterThan = filter.greaterThan;
        this.lessThan = filter.lessThan;
        this.greaterThanOrEqual = filter.greaterThanOrEqual;
        this.lessThanOrEqual = filter.lessThanOrEqual;
    }

    public RangeFilter<T> setGreaterThan(T greaterThan) {
        this.greaterThan = greaterThan;
        return this;
    }

    public RangeFilter<T> setLessThan(T lessThan) {
        this.lessThan = lessThan;
        return this;
    }

    public RangeFilter<T> setGreaterThanOrEqual(T greaterThanOrEqual) {
        this.greaterThanOrEqual = greaterThanOrEqual;
        return this;
    }

    public RangeFilter<T> setLessThanOrEqual(T lessThanOrEqual) {
        this.lessThanOrEqual = lessThanOrEqual;
        return this;
    }
}
