package com.pcloud.book.copyright.dto;

import com.google.common.collect.Lists;
import com.pcloud.common.dto.BaseDto;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.CollectionUtils;

import java.util.Date;
import java.util.List;

/**
 * @author hzk
 * @date 2019/7/11 17:02
 */
@ApiModel
public class BookAuthCodeDTO extends BaseDto {

    private static final long serialVersionUID = -2646713544720373882L;

    private Long id;

    @ApiModelProperty("图书标识")
    private Long bookId;

    @ApiModelProperty("运营标识")
    private Long channelId;

    @ApiModelProperty("编辑标识")
    private Long adviserId;

    @ApiModelProperty("授权码")
    private String authCode;

    @ApiModelProperty("批次号")
    private String batchNum;

    @ApiModelProperty("完整授权码")
    private String fullCode;

    @ApiModelProperty("使用次数")
    private Integer useCount;

    @ApiModelProperty("创建方式")
    private Integer createType;

    @ApiModelProperty("创建人")
    private Long createdUser;

    @ApiModelProperty("创建时间")
    private Date createdDate;

    @ApiModelProperty("最后修改人")
    private Long lastModifiedUser;

    @ApiModelProperty("最后修改时间")
    private Date lastModifiedDate;

    @ApiModelProperty("使用授权码的用户")
    private List<BookAuthUserDTO> bookAuthUserList;

    /**
     * 新版 授权码链接
     */
    private String qrcodeUrl;

    public String getQrcodeUrl() {
        return qrcodeUrl;
    }

    public void setQrcodeUrl(String qrcodeUrl) {
        this.qrcodeUrl = qrcodeUrl;
    }

    public String getFullCode() {
        return fullCode;
    }

    public void setFullCode(String fullCode) {
        this.fullCode = fullCode;
    }

    public Long getId() {
        return id;
    }

    public String getBatchNum() {
        return batchNum;
    }

    public void setBatchNum(String batchNum) {
        this.batchNum = batchNum;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getBookId() {
        return bookId;
    }

    public void setBookId(Long bookId) {
        this.bookId = bookId;
    }

    public Long getChannelId() {
        return channelId;
    }

    public void setChannelId(Long channelId) {
        this.channelId = channelId;
    }

    public Long getAdviserId() {
        return adviserId;
    }

    public void setAdviserId(Long adviserId) {
        this.adviserId = adviserId;
    }

    public String getAuthCode() {
        return authCode;
    }

    public void setAuthCode(String authCode) {
        this.authCode = authCode;
    }

    public Integer getUseCount() {
        return useCount;
    }

    public void setUseCount(Integer useCount) {
        this.useCount = useCount;
    }

    public Integer getCreateType() {
        return createType;
    }

    public void setCreateType(Integer createType) {
        this.createType = createType;
    }

    @Override
    public Long getCreatedUser() {
        return createdUser;
    }

    @Override
    public void setCreatedUser(Long createdUser) {
        this.createdUser = createdUser;
    }

    @Override
    public Date getCreatedDate() {
        return createdDate;
    }

    @Override
    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    @Override
    public Long getLastModifiedUser() {
        return lastModifiedUser;
    }

    @Override
    public void setLastModifiedUser(Long lastModifiedUser) {
        this.lastModifiedUser = lastModifiedUser;
    }

    @Override
    public Date getLastModifiedDate() {
        return lastModifiedDate;
    }

    @Override
    public void setLastModifiedDate(Date lastModifiedDate) {
        this.lastModifiedDate = lastModifiedDate;
    }

    public List<BookAuthUserDTO> getBookAuthUserList() {
        if(CollectionUtils.isEmpty(this.bookAuthUserList)){
            return Lists.newArrayList();
        }
        return bookAuthUserList;
    }

    public void setBookAuthUserList(List<BookAuthUserDTO> bookAuthUserList) {
        this.bookAuthUserList = bookAuthUserList;
    }

    @Override
    public String toString() {
        return "BookAuthCode{" +
                "id=" + id +
                ", bookId=" + bookId +
                ", channelId=" + channelId +
                ", adviserId=" + adviserId +
                ", authCode='" + authCode + '\'' +
                ", batchNum='" + batchNum + '\'' +
                ", fullCode='" + fullCode + '\'' +
                ", useCount=" + useCount +
                ", createType=" + createType +
                ", createdUser=" + createdUser +
                ", createdDate=" + createdDate +
                ", lastModifiedUser=" + lastModifiedUser +
                ", lastModifiedDate=" + lastModifiedDate +
                '}';
    }
}
