package ctop.bytedance.ad.advertise.entity;

import com.alibaba.fastjson.JSONObject;
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 java.math.BigDecimal;
import java.util.Date;

/**
 * 今日头条广告主信息
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2019-07-22
 */
@Data
@TableName("ctop_bytedance_advertiser")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "ctop_bytedance_advertiser对象", description = "今日头条广告主信息")
public class ByteDanceAdvertiser {

    /**
     * 外部平台头条id
     */
    @TableId
    private Long id;
    /**
     * 本平台id
     */
    private String advertiserId;
    /**
     * 头条账户名
     */
    private String name;
    /**
     * 品牌描述,即推广内容
     */
    private String description;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 联系人
     */
    private String contacter;
    /**
     * 手机号
     */
    private String phonenumber;
    /**
     *  角色
     */
    private String role;
    /**
     *  头条广告主状态
     */
    private String toutiaoStatus;
    /**
     * 固定电话
     */
    private String telephone;
    /**
     * 地址
     */
    private String address;
    /**
     * 执照预览地址(链接默认1小时内有效)
     */
    private String licenseUrl;
    /**
     * 执照编号
     */
    private String licenseNo;
    /**
     * 执照省份
     */
    private String licenseProvince;
    /**
     * 执照城市
     */
    private String licenseCity;
    /**
     * 公司名称
     */
    private String company;
    /**
     * 经营类别
     */
    private String brand;
    /**
     * 运营区域
     */
    private String promotionArea;
    /**
     * 运营省份
     */
    private String promotionCenterProvince;
    /**
     * 运营城市
     */
    private String promotionCenterCity;
    /**
     * 一级行业名称
     */
    private String firstIndustryName;
    /**
     * 二级行业名称
     */
    private String secondIndustryName;
    /**
     * 审核拒绝原因
     */
    private String reason;
    /**
     * 账户总余额，单位元
     */
    private BigDecimal balance;
    /**
     * 头条平台中广告主创建时间
     */
    private String toutiaoCreateTime;
    /**
     * 数据状态
     */
    private Integer status;
    /**
     * createTime
     */
    @ApiModelProperty(value = "createTime")
    private Date createTime;
    /**
     * updateTime
     */
    @ApiModelProperty(value = "updateTime")
    private Date updateTime;

    public ByteDanceAdvertiser(JSONObject dataObject, String accountId) {
        Long id = dataObject.getLong("id");
        this.id = id;
        this.advertiserId = accountId;
        String name = dataObject.getString("name");
        if (null != name && !"".equals(name.trim())) {
            this.name = name;
        }
        String description = dataObject.getString("description");
        if (null != description && !"".equals(description.trim())) {
            this.description = description;
        }
        String email = dataObject.getString("email");
        if (null != email && !"".equals(email.trim())) {
            this.email = email;
        }
        String contacter = dataObject.getString("contacter");
        if (null != contacter && !"".equals(contacter.trim())) {
            this.contacter = contacter;
        }
        String phonenumber = dataObject.getString("phonenumber");
        if (null != phonenumber && !"".equals(phonenumber.trim())) {
            this.phonenumber = phonenumber;
        }
        String role = dataObject.getString("role");
        if (null != role && !"".equals(role.trim())) {
            this.role = role;
        }
        String status = dataObject.getString("status");
        if (null != status && !"".equals(status.trim())) {
            this.toutiaoStatus = status;
        }
        String telephone = dataObject.getString("telephone");
        if (null != telephone && !"".equals(telephone.trim())) {
            this.telephone = telephone;
        }
        String address = dataObject.getString("address");
        if (null != address && !"".equals(address.trim())) {
            this.address = address;
        }
        String licenseUrl = dataObject.getString("license_url");
        if (null != licenseUrl && !"".equals(licenseUrl.trim())) {
            this.licenseUrl = licenseUrl;
        }
        String licenseNo = dataObject.getString("license_no");
        if (null != licenseNo && !"".equals(licenseNo.trim())) {
            this.licenseNo = licenseNo;
        }
        String licenseProvince = dataObject.getString("license_province");
        if (null != licenseProvince && !"".equals(licenseProvince.trim())) {
            this.licenseProvince = licenseProvince;
        }
        String licenseCity = dataObject.getString("license_city ");
        if (null != licenseCity && !"".equals(licenseCity.trim())) {
            this.licenseCity = licenseCity;
        }
        String company = dataObject.getString("company");
        if (null != company && !"".equals(company.trim())) {
            this.company = company;
        }
        String brand = dataObject.getString("brand");
        if (null != brand && !"".equals(brand.trim())) {
            this.brand = brand;
        }
        String promotionArea = dataObject.getString("promotion_area");
        if (null != promotionArea && !"".equals(promotionArea.trim())) {
            this.promotionArea = promotionArea;
        }
        String promotionCenterProvince = dataObject.getString("promotion_center_province ");
        if (null != promotionCenterProvince && !"".equals(promotionCenterProvince.trim())) {
            this.promotionCenterProvince = promotionCenterProvince;
        }
        String promotionCenterCity = dataObject.getString("promotion_center_city");
        if (null != promotionCenterCity && !"".equals(promotionCenterCity.trim())) {
            this.promotionCenterCity = promotionCenterCity;
        }
        String firstIndustryName = dataObject.getString("first_industry_name ");
        if (null != firstIndustryName && !"".equals(firstIndustryName.trim())) {
            this.firstIndustryName = firstIndustryName;
        }
        String secondIndustryName = dataObject.getString("second_industry_name");
        if (null != secondIndustryName && !"".equals(secondIndustryName.trim())) {
            this.secondIndustryName = secondIndustryName;
        }
        String reason = dataObject.getString("reason");
        if (null != reason && !"".equals(reason.trim())) {
            this.reason = reason;
        }
        BigDecimal balance = dataObject.getBigDecimal("balance");
        if (null != balance) {
            this.balance = balance;
        }
        String createTime = dataObject.getString("create_time ");
        if (null != createTime && !"".equals(createTime.trim())) {
            this.toutiaoCreateTime = createTime;
        }
        Date now = new Date();
        this.createTime = now;
        this.updateTime = now;
    }

    public ByteDanceAdvertiser() {

    }
}
