package org.jeecg.modules.bytedance.advertise.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;

import java.util.Date;

@Data
@TableName("ctop_bytedance_creative_word_package")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "ctop_bytedance_creative_word_package对象", description = "今日头条创意词包")
public class ByteDanceCreativeWordPackage {


    /**id*/
    @TableId(type = IdType.UUID)
    @ApiModelProperty(value = "id")
    private Integer id;
    /**creativeWordId*/
    @Excel(name = "creativeWordId", width = 15)
    @ApiModelProperty(value = "creativeWordId")
    private Integer creativeWordId;
    /**name*/
    @Excel(name = "name", width = 15)
    @ApiModelProperty(value = "name")
    private String name;
    /**defaultWord*/
    @Excel(name = "defaultWord", width = 15)
    @ApiModelProperty(value = "defaultWord")
    private String defaultWord;
    /**words*/
    @Excel(name = "words", width = 15)
    @ApiModelProperty(value = "words")
    private Object words;
    /**contentType*/
    @Excel(name = "contentType", width = 15)
    @ApiModelProperty(value = "contentType")
    private String contentType;
    /**maxWordLen*/
    @Excel(name = "maxWordLen", width = 15)
    @ApiModelProperty(value = "maxWordLen")
    private Integer maxWordLen;
    /**status*/
    @Excel(name = "status", width = 15)
    @ApiModelProperty(value = "status")
    private String status;
    /**userRate*/
    @Excel(name = "userRate", width = 15)
    @ApiModelProperty(value = "userRate")
    private Float userRate;
    /**createTime*/
    @ApiModelProperty(value = "createTime")
    private Date createTime;
    /**updateTime*/
    @ApiModelProperty(value = "updateTime")
    private Date updateTime;



    public ByteDanceCreativeWordPackage(){}

    public ByteDanceCreativeWordPackage(JSONObject jsonObject){
        int creativeWordId = jsonObject.getInteger("creative_word_id");
        this.creativeWordId = creativeWordId;

        int maxWordLen = jsonObject.getInteger("max_word_len");
        this.maxWordLen = maxWordLen;

        String name = jsonObject.getString("name");
        if (null != name && !"".equals(name.trim())) {
            this.name = name;
        }

        String defaultWord = jsonObject.getString("default_word");
        if (null != defaultWord && !"".equals(defaultWord.trim())) {
            this.defaultWord = defaultWord;
        }

        String words = jsonObject.getString("words");
        if (null != words && !"".equals(words.trim())) {
            this.words = words;
        }

        String contentType = jsonObject.getString("content_type");
        if (null != contentType && !"".equals(contentType.trim())) {
            this.contentType = contentType;
        }

        String status = jsonObject.getString("status");
        if (null != status && !"".equals(status.trim())) {
            this.status = status;
        }

        Float userRate = jsonObject.getFloat("user_rate");
        this.userRate = userRate;
    }


}
