package com.ycwl.basic.model.mobile.goods;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

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

/**
 * @Author：longbinbin
 * @Date：2024/12/5 15:10
 */
@Data
// vlog商品详情
public class VideoGoodsDetailVO {
    // 商品名称
    private String goodsName;
    // 景区id
    private Long scenicId;
    // 景区名称
    private String scenicName;
    // 经度
    private BigDecimal longitude;
    // 纬度
    private BigDecimal latitude;
    // 商品类型 1:成片视频 2:源素材
    private Integer goodsType;
    // 源素材类型 1:视频 2:图片
    private Integer sourceType;
    // 商品id goodsType=1时为videoId，goodsType=2时为sourceId
    private Long goodsId;
    private Long templateId;
    // 模版封面图片
    private String templateCoverUrl;
    // 图片文件存储地址
    private String url;
    // 视频文件存储地址
    private String videoUrl;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date shotTime;
    // 价格
    private Integer couponId;
    private Integer couponRecordId;
    private BigDecimal couponPrice;
    private BigDecimal origPrice;
    private String price;
    private BigDecimal slashPrice;
    // 是否已购买 0否 1是
    private Integer isBuy;
    // 镜头数
    private Integer devicesNum;
    private Integer lensNum;
    private Long faceId;
    private boolean share = false;
    private Integer height;
    private Integer width;
    private BigDecimal duration;

    @JsonProperty("discountPrice")
    public BigDecimal getDiscountPrice() {
        if (slashPrice == null) {
            return BigDecimal.ZERO;
        }
        if (slashPrice.compareTo(BigDecimal.ZERO) <= 0) {
            return BigDecimal.ZERO;
        }
        return slashPrice.subtract(origPrice);
    }
}
