package com.ruoyi.demo.entity.vo;

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 com.ruoyi.demo.utils.StateUtil;
import lombok.Data;

import java.time.LocalDateTime;

// 广告推送计划列表
@Data
public class PlanPushListVo {
    private String planId;
//    private String goodsImg;
    private String goodsLogo;
    private String principalName;
    private String principalTelephone;
    private String state;
    @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;
    private Integer equipmentCount;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime planCreateTime;

    public PlanPushListVo(){}
    public PlanPushListVo(Plan plan){
        this.planId = plan.getPlanId();
//        this.goodsImg = plan.getGoodsImg();
        this.goodsLogo = plan.getGoodsLogo();
        this.principalName = plan.getPrincipalName();
        this.principalTelephone = plan.getPrincipalTelephone();
        //this.planCreateTime = plan.getPlanCreateTime();
        this.planStartTime = plan.getPlanStartTime();
        this.planEndTime = plan.getPlanEndTime();
        this.state = StateUtil.getStateName(plan.getState());
    }
}
