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.OnStateUtil;
import lombok.Data;

import java.time.LocalDateTime;

// 广告计划列表
@Data
public class PlanListVo {
    private String planId;
    private String planName;
    private String goodsImg;
    private String principalName;
    private String principalTelephone;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime planCreateTime;
    private String onState;

    public PlanListVo(){}
    public PlanListVo(Plan plan){
        this.planId = plan.getPlanId();
        this.planName = plan.getPlanName();
        this.principalName = plan.getPrincipalName();
        this.principalTelephone = plan.getPrincipalTelephone();
        this.goodsImg = plan.getGoodsImg();
        this.planCreateTime = plan.getPlanCreateTime();
        this.onState = OnStateUtil.getOnStateChar(plan.getOnState());
    }
}
