package com.apobates.forum.thrones.admin.controller.form;

import com.apobates.forum.core.ImageIOMeta;
import java.util.Optional;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Positive;

/**
 *
 * @author xiaofanku
 * @since 20200603
 */
public class BoardGroupForm extends ActionForm {
    @NotBlank(message="{NotBlank.BoardGroupForm.title}")
    private String title;
    @NotBlank(message="{NotBlank.BoardGroupForm.description}")
    private String description;
    private String imageAddr;
    //上传后的图片地址
    private String fileurl;
    @NotBlank(message="{NotBlank.BoardGroupForm.ranking}")
    @Positive(message="{Positive.BoardGroupForm.ranking}")
    private String ranking = "1";
    //private boolean status;
    
    public String getTitle() {
        return title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public String getImageAddr() {
        return imageAddr;
    }
    
    public void setImageAddr(String imageAddr) {
        this.imageAddr = imageAddr;
    }
    
    public int getIntegerRanking() {
        return covertStringToInteger(getRanking(), 1);
    }
    
    public String getRanking() {
        return ranking;
    }
    
    public void setRanking(String ranking) {
        this.ranking = ranking;
    }
    
    public String getFileurl() {
        return fileurl;
    }
    
    public void setFileurl(String fileurl) {
        this.fileurl = fileurl;
    }
    public Optional<String> getEncodeIcoAddr(ImageIOMeta imageIOMeta){
        return encodeUploadImageURL(imageIOMeta, getFileurl());
    }
}