package com.microservices.zone.member.domain.vo;

import com.microservices.zone.member.domain.points.ZonePointsTransaction;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;

/**
 * 积分流水更新对象（合并事件+流水）
 *
 * @author otto
 */
@Data
@ApiModel("积分流水更新对象")
public class ZonePointsTransactionUpdateVo {

    @ApiModelProperty(value = "流水ID", required = true)
    @NotNull
    private Long id;

    @ApiModelProperty(value = "类型：add增/reduce减/freezed冻结/unfreezed解冻")
    private String transactionType;

    @ApiModelProperty(value = "积分数量（正数）")
    private int points;

    @ApiModelProperty(value = "变动后可用积分")
    private int availableAfter;

    @ApiModelProperty(value = "变动后冻结积分")
    private int frozenAfter;

    @ApiModelProperty(value = "事件类型")
    private String eventType;

    @ApiModelProperty(value = "变动原因")
    private String reason;

    @ApiModelProperty(value = "回复内容")
    private String replyContent;

    @ApiModelProperty(value = "主题")
    private String subject;

    @ApiModelProperty(value = "主题描述")
    private String subjectDesc;

    public ZonePointsTransaction toZonePointsTransaction() {
        ZonePointsTransaction zonePointsTransaction = new ZonePointsTransaction();
        zonePointsTransaction.setId(id);
        zonePointsTransaction.setTransactionType(transactionType);
        zonePointsTransaction.setPoints(points);
        zonePointsTransaction.setAvailableAfter(availableAfter);
        zonePointsTransaction.setFrozenAfter(frozenAfter);
        zonePointsTransaction.setEventType(eventType);
        zonePointsTransaction.setReason(reason);
        zonePointsTransaction.setReplyContent(replyContent);
        zonePointsTransaction.setSubject(subject);
        zonePointsTransaction.setSubjectDesc(subjectDesc);
        return zonePointsTransaction;
    }
}