package com.eshore.gringotts.web.domain.base.controller.query;

import lombok.Data;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.map.ImmutableMap;

/**
 * 统一查询
 *
 * @author lanyuanxiaoyao
 * @date 2024-12-03
 */
@Data
public class Query {
    private Queryable query;
    private ImmutableList<Sortable> sort;
    private Pageable page;

    @Data
    public static class Queryable {
        private ImmutableList<String> nullEqual;
        private ImmutableList<String> notNullEqual;
        private ImmutableList<String> empty;
        private ImmutableList<String> notEmpty;
        private ImmutableMap<String, ?> equal;
        private ImmutableMap<String, ?> notEqual;
        private ImmutableMap<String, String> like;
        private ImmutableMap<String, String> notLike;
        private ImmutableMap<String, ?> great;
        private ImmutableMap<String, ?> less;
        private ImmutableMap<String, ?> greatEqual;
        private ImmutableMap<String, ?> lessEqual;
        private ImmutableMap<String, ImmutableList<?>> in;
        private ImmutableMap<String, ImmutableList<?>> notIn;
        private ImmutableMap<String, Between> between;
        private ImmutableMap<String, Between> notBetween;

        @Data
        public static class Between {
            private String start;
            private String end;
        }
    }

    @Data
    public static class Sortable {
        private String column;
        private Direction direction;

        public enum Direction {
            ASC,
            DESC,
        }
    }

    @Data
    public static class Pageable {
        private Integer page;
        private Integer size;
    }
}
