package cn.iocoder.yudao.module.order.vo.orderTime;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import com.alibaba.excel.annotation.ExcelProperty;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

/**
* 下单时间轴事件 Response VO
* @author 系统管理员
*/
@Data
@ApiModel("管理后台 - 下单时间轴事件 Response VO")
public class OrderTimeBackVO {

    @ExcelProperty("主键ID")
    @ApiModelProperty(value = "主键ID", required = true)
    private Long id;

    @ExcelProperty("订单id")
    @ApiModelProperty(value = "订单id")
    private Long orderId;

    @ExcelProperty("订单状态 详见字典 order_status")
    @ApiModelProperty(value = "订单状态 详见字典 order_status")
    private Integer status;

    @ApiModelProperty(value = "中文标题")
    private String titleZh;

    @ApiModelProperty(value = "中文标题")
    private String title_zh;

    @ExcelProperty("")
    @ApiModelProperty(value = "英文标题")
    private String titleEn;

    @ApiModelProperty(value = "英文标题")
    private String title_en;


    @ExcelProperty("")
    @ApiModelProperty(value = "法文标题")
    private String titleFr;

    @ApiModelProperty(value = "法文标题")
    private String title_fr;
    /**
     * 中文备注
     */
    @ApiModelProperty(value = "中文备注")
    private String remarksZh;
    /**
     * 英文备注
     */
    @ApiModelProperty(value = "英文备注")
    private String remarksEn;
    /**
     * 法文备注
     */
    @ApiModelProperty(value = "英文备注")
    private String remarksFr;

    @ExcelProperty("创建时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @ApiModelProperty(value = "创建时间", required = true)
    private Date createTime;

    @ExcelProperty("业务时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @ApiModelProperty(value = "业务时间")
    private Date businessTime;

    private Long addtime;

    /**
     * 类型
     */
    @ApiModelProperty(value = "类型")
    private Integer type;

    @ApiModelProperty(value = "标记颜色：0 默认不标记 1 红色")
    private Integer mark = 0;
    @TableField(exist = false)
    private String statusType;

    public String getStatusType() {
        return statusType = this.status + "-" + this.type;
    }

    public void setAddtime(Long addtime) {
        this.addtime = addtime;
        if (Objects.nonNull(addtime)){
            this.createTime = new Date(addtime * 1000L);
            this.businessTime = new Date(addtime * 1000L);
//            if(StringUtils.isNotBlank(this.title_en) && StringUtils.isNotBlank(this.title_zh)){
//                this.titleZh = this.title_zh + "   " + DateUtil.formatDateTime(this.createTime);
//                this.titleEn = this.title_en + "   " + DateUtil.formatDateTime(this.createTime);
//            }
        }
    }

    public void setTitle_zh(String title_zh) {
        this.title_zh = title_zh;
        if (StringUtils.isNotBlank(title_zh)){
            this.titleZh = title_zh;
//            if(Objects.nonNull(this.createTime) && StringUtils.isNotBlank(this.title_en)){
//                this.titleZh = this.title_zh + "   " + DateUtil.formatDateTime(this.createTime);
//                this.titleEn = this.title_en + "   " + DateUtil.formatDateTime(this.createTime);
//            }
        }
    }

    public void setTitle_en(String title_en) {
        this.title_en = title_en;
        if (StringUtils.isNotBlank(title_en)){
            this.titleEn = title_en;
//            if(Objects.nonNull(this.createTime) && StringUtils.isNotBlank(this.title_zh)){
//                this.titleZh = this.title_zh + "   " + DateUtil.formatDateTime(this.createTime);
//                this.titleEn = this.title_en + "   " + DateUtil.formatDateTime(this.createTime);
//            }
        }
    }
    public void setTitle_fr(String title_fr) {
        this.title_fr = title_fr;
        if (StringUtils.isNotBlank(title_fr)){
            this.titleFr = title_fr;
//            if(Objects.nonNull(this.createTime) && StringUtils.isNotBlank(this.title_zh)){
//                this.titleZh = this.title_zh + "   " + DateUtil.formatDateTime(this.createTime);
//                this.titleEn = this.title_en + "   " + DateUtil.formatDateTime(this.createTime);
//            }
        }
    }
}
