package com.cool.store.vo.tp;

import com.cool.store.enums.JoinModeEnum;
import com.cool.store.enums.StoreTypeEnum;
import com.cool.store.enums.master.BrandTypeEnum;
import com.cool.store.enums.tp.TpFormTypeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;

/**
 * <p>
 * 积分流水VO
 * </p>
 *
 * @author wangff
 * @since 2025/11/10
 */
@Data
public class TpScoreJournalVO {
    @ApiModelProperty("流水号")
    private String journalNo;

    @ApiModelProperty("门店编码")
    private String storeNum;

    @ApiModelProperty("加盟品牌")
    private Integer joinBrand;

    @ApiModelProperty("加盟品牌名称")
    private String joinBrandName;

    @ApiModelProperty("加盟模式")
    private Integer joinModel;

    @ApiModelProperty("加盟模式名称")
    private String joinModelName;

    @ApiModelProperty("门店类型")
    private Integer storeType;

    @ApiModelProperty("门店类型名称")
    private String storeTypeName;

    @ApiModelProperty("门店名称")
    private String storeName;

    @ApiModelProperty("发生分值")
    private String occurScore;

    @ApiModelProperty("发生日期")
    private Date occurDate;

    @ApiModelProperty("发生前分值")
    private BigDecimal occurBeforeScore;

    @ApiModelProperty("发生后分值")
    private BigDecimal occurAfterScore;

    @ApiModelProperty("单据类型")
    private Integer applyType;

    @ApiModelProperty("单据类型名称")
    private String applyTypeName;

    @ApiModelProperty("来源单号")
    private String applyNo;

    @ApiModelProperty("项目大类")
    private String projectCategory;

    @ApiModelProperty("项目名称")
    private String projectName;

    @ApiModelProperty("规则编码")
    private String ruleNo;

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

    @JsonIgnore
    private String remark;

    public String getJoinBrandName() {
        return BrandTypeEnum.getDescByCode(this.joinBrand);
    }

    public String getJoinModelName() {
        return JoinModeEnum.getDescByCode(this.joinModel);
    }

    public String getStoreTypeName() {
        return StoreTypeEnum.getMessage(this.storeType);
    }

    public String getApplyTypeName() {
        TpFormTypeEnum type = TpFormTypeEnum.getByType(this.applyType);
        return Objects.nonNull(type) ? type.getAlias() : null;
    }
}
