package org.nl.acs.log.domain;

import org.nl.acs.common.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @author jiaolm
* @date 2023-05-09
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("acs_log")
public class Log extends CommonModel<Log> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "日志标识")
    @TableId(type= IdType.ASSIGN_ID)
    private String log_uuid;

    @ApiModelProperty(value = "任务编码")
    @NotBlank
    private String task_code;

    @ApiModelProperty(value = "任务标识")
    @NotBlank
    private String task_id;

    private String vehicle_code;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "日志类型")
    @NotBlank
    private String log_type;

    @ApiModelProperty(value = "方法")
    @NotBlank
    private String method;

    @ApiModelProperty(value = "请求参数")
    @NotBlank
    private String requestparam;

    @ApiModelProperty(value = "返回参数")
    @NotBlank
    private String responseparam;

    @ApiModelProperty(value = "请求地址")
    @NotBlank
    private String requesturl;

    @ApiModelProperty(value = "状态码")
    @NotBlank
    private String status_code;

    @ApiModelProperty(value = "是否删除")
    @NotBlank
    private String is_delete;

    @ApiModelProperty(value = "创建者")
    @NotBlank
    @TableField(fill= FieldFill.INSERT)
    private String create_by;

    @ApiModelProperty(value = "创建时间")
    @NotBlank
    @TableField(fill= FieldFill.INSERT)
    private String create_time;

    @ApiModelProperty(value = "修改者")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String update_by;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String update_time;

    public void copyFrom(Log source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
