package com.apobates.forum.thrones.vo;

import com.apobates.forum.core.entity.Board;
import com.apobates.forum.core.entity.proxy.BoardReplica;
import java.io.Serializable;

/**
 * 版块汇总统计(右侧的版块统计)
 *
 * @author xiaofanku
 * @since 20200525
 */
public final class ForumBoardStats implements Serializable {
    private static final long serialVersionUID = 1265034484256240L;
    //版块名称
    private final String title;
    //版块的连接
    private final String link;
    //回复数
    private final long postses;
    //主题数
    private final long topices;
    //版块的ID
    private final long id;
    
    public ForumBoardStats(Board board, long postses, long topices) {
        this.title = board.getTitle(); 
        String connect = BoardReplica.generateConnectString(board.getId(), board.getVolumesId());
        this.link = String.format("/board/%s.xhtml", connect);
        this.postses = postses;
        this.topices = topices;
        this.id = board.getId();
    }
    
    public ForumBoardStats(Board board) {
        this.title = board.getTitle(); 
        String connect = BoardReplica.generateConnectString(board.getId(), board.getVolumesId());
        this.link = String.format("/board/%s.xhtml", connect);
        this.postses = 0L;
        this.topices = 0L;
        this.id = board.getId();
    }
    
    public String getTitle() {
        return title;
    }
    
    public long getPostses() {
        return postses;
    }
    
    public long getTopices() {
        return topices;
    }
    
    public String getLink() {
        return link;
    }
    
    public long getId() {
        return id;
    }
}