package com.ruoyi.demo.entity.bo;

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.Brand;
import com.ruoyi.demo.entity.Enterprise;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class BrandInfo implements Serializable {
    private String brandId;
    private String brandName;
    private String brandImg;
    private String industryName;
    private String businessModel;
    private Float indexScore;
    private String enterpriseUsci;
    private String enterpriseName;
    private String addrInfo;
    private String addrCode;
    private String contact;
    private String telephone;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime updateTime;
    private Integer attention;

    public BrandInfo() {
    }

    public BrandInfo(Brand brand, Enterprise enterprise) {
        this.brandId = brand.getBrandId();
        this.brandName = brand.getBrandName();
        this.brandImg = brand.getBrandImg();
        this.businessModel = brand.getBusinessModel();
        this.indexScore = brand.getIndexScore();
        if (enterprise != null) {
            this.enterpriseUsci = enterprise.getEnterpriseUsci();
            this.enterpriseName = enterprise.getEnterpriseName();
            this.addrCode = enterprise.getAddrCode();
            this.addrInfo = enterprise.getAddrInfo();
        }
        this.contact = brand.getContact();
        this.telephone = brand.getTelephone();
        this.updateTime = brand.getUpdateTime();
        this.attention = 0;
    }
}
