package jp.sourceforge.shovel.form.impl;

import static jp.sourceforge.shovel.FormatType.*;
import static jp.sourceforge.shovel.StatisticsType.*;

import org.seasar.struts.annotation.tiger.StrutsActionForm;

import jp.sourceforge.shovel.FormatType;
import jp.sourceforge.shovel.StatisticsType;
import jp.sourceforge.shovel.form.IStatisticsForm;

@StrutsActionForm(name = "statisticsForm")
public class StatisticsFormImpl implements IStatisticsForm {
    int count_;
    FormatType formatType_;
    long userId_;
    String foreignKey_;
    StatisticsType statisticsType_;
    
    public int getCount() {
        return count_;
    }
    public void setCount(int count) {
        count_ = count;
    }
    public String getFormat() {
        return getFormatType().getId();
    }
    public void setFormat(String format) {
        setFormatType(FormatType.find(format));
    }
    public FormatType getFormatType() {
        return formatType_ == null ? HTML : formatType_;
    }
    public void setFormatType(FormatType formatType) {
        formatType_ = formatType;
    }
    public String getForeignKey() {
        return foreignKey_ == null ? "" : foreignKey_;
    }
    public void setForeignKey(String foreignKey) {
        foreignKey_ = foreignKey;
    }
    public String getType() {
        return getStatisticsType().getKey();
    }
    public void setType(String type) {
        setStatisticsType(StatisticsType.find(type));
    }
    public StatisticsType getStatisticsType() {
        return statisticsType_ == null ? USER_STATUSES : statisticsType_;
    }
    public void setStatisticsType(StatisticsType statisticsType) {
        statisticsType_ = statisticsType;
    }
    public long getUserId() {
        return userId_;
    }
    public void setUserId(long userId) {
        userId_ = userId;
    }
}
