package com.slodon.b2b2c.vo.goods;

import com.slodon.b2b2c.core.response.PagerInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 *
 * 封装榜单聚合页VO对象
 * @author wuxy
 */
@Data
public class FrontGoodsRankListVO {

    @ApiModelProperty("榜单列表")
    private List<RankRecommendVO> rankList;

    @ApiModelProperty("榜单类型列表")
    private List<RankTypeVO> typeList;

    @ApiModelProperty("分页信息")
    private Pagination pagination;

    public FrontGoodsRankListVO(List<RankRecommendVO> rankList, List<RankTypeVO> typeList, PagerInfo pager) {
        this.rankList = rankList;
        this.typeList = typeList;
        if (pager != null) {
            this.pagination = new Pagination(pager.getPageIndex(), pager.getPageSize(), pager.getRowsCount());
        }
    }

    @Data
    public static class RankTypeVO {

        @ApiModelProperty("类型id")
        private Integer typeId;

        @ApiModelProperty("类型名称")
        private String typeName;
    }

    @Data
    private class Pagination {

        @ApiModelProperty("当前页面位置")
        private Integer current;
        @ApiModelProperty("分页大小")
        private Integer pageSize;
        @ApiModelProperty("总数")
        private Integer total;

        private Pagination(Integer current, Integer pageSize, Integer total) {
            this.current = current;
            this.pageSize = pageSize;
            this.total = total;
        }
    }
}
