package com.ruoyi.demo.entity.bo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.ruoyi.demo.entity.Plan;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
public class PlanItemBo {
    private String itemId;
    private String planId;
    private String planName;
    private String commercialId;
    private String commercialName;
    private String appkey;
    private String appName;
    private String goodsId;
    private String goodsImg;
    private String goodsName;
    private String goodsLogo;
    private String goodsIntroduce;
    private Float goodsPrice;
    private String goodsClassify;
    private int sort;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime planCreateTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime planStartTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime planEndTime;

    @TableField("deleted")
    private int deleted;

    public PlanItemBo(Plan plan) {
        this.planId = plan.getPlanId();
        this.commercialId = plan.getCommercialId();
        this.commercialName = plan.getCommercialName();
        this.appkey = plan.getAppkey();
        this.appName = plan.getAppName();
        this.goodsId = plan.getGoodsId();
        this.goodsImg = plan.getGoodsImg();
        this.goodsName = plan.getGoodsName();
        this.goodsLogo = plan.getGoodsLogo();
        this.goodsIntroduce = plan.getGoodsIntroduce();
        this.goodsPrice = plan.getGoodsPrice();
        this.goodsClassify = plan.getGoodsClassify();
        this.planCreateTime = plan.getPlanCreateTime();
        this.planStartTime = plan.getPlanStartTime();
        this.planEndTime = plan.getPlanEndTime();
        this.planName = plan.getPlanName();
    }
}
