package cn.reghao.tnb.content.app.vod.model.query;

import cn.reghao.tnb.content.api.constant.VideoStatus;
import lombok.Getter;

import java.util.List;

/**
 * @author reghao
 * @date 2023-09-18 11:36:52
 */
@Getter
public class VideoQuery {
    private List<Integer> status;
    private List<Integer> scope;
    private Integer categoryPid;
    private Integer categoryId;
    private Long userId;
    private String videoId;
    private String title;
    private Boolean horizontal;
    private Integer duration;
    private String groupBy;
    private String orderBy;
    private String orderDirection;

    private VideoQuery(Builder builder) {
        this.status = builder.status;
        this.scope = builder.scope;
        this.categoryPid = builder.categoryPid;
        this.categoryId = builder.categoryId;
        this.userId = builder.userId;
        this.videoId = builder.videoId;
        this.title = builder.title;
        this.horizontal = builder.horizontal;
        this.duration = builder.duration;
        this.groupBy = builder.groupBy;
        this.orderBy = builder.orderBy;
        this.orderDirection = builder.orderDirection;
    }

    public static final class Builder {
        private List<Integer> status;
        private List<Integer> scope;
        private Integer categoryPid;
        private Integer categoryId;
        private Long userId;
        private String videoId;
        private String title;
        private Boolean horizontal;
        private Integer duration;
        private String groupBy;
        private String orderBy;
        private String orderDirection;

        public Builder() {
            this.status = List.of(VideoStatus.publish.getCode(), VideoStatus.noVideoFile.getCode());
            //this.scope = List.of(PostScope.PUBLIC.getCode());
        }

        public Builder status(List<Integer> status) {
            this.status = status;
            return this;
        }

        public Builder scope(List<Integer> scope) {
            this.scope = scope;
            return this;
        }

        public Builder categoryPid(int categoryPid) {
            this.categoryPid = categoryPid;
            return this;
        }

        public Builder categoryId(int categoryId) {
            this.categoryId = categoryId;
            return this;
        }

        public Builder userId(long userId) {
            this.userId = userId;
            return this;
        }

        public Builder horizontal(boolean horizontal) {
            this.horizontal = horizontal;
            return this;
        }

        public Builder duration(int duration) {
            this.duration = duration;
            return this;
        }

        public Builder videoId(String videoId) {
            this.videoId = videoId;
            return this;
        }

        public Builder title(String title) {
            this.title = title;
            return this;
        }

        public Builder groupBy(String groupBy) {
            this.groupBy = groupBy;
            return this;
        }

        public Builder orderBy(String orderBy) {
            this.orderBy = orderBy;
            return this;
        }

        public Builder orderDirection(String orderDirection) {
            this.orderDirection = orderDirection;
            return this;
        }

        public VideoQuery build() {
            return new VideoQuery(this);
        }
    }
}
