package com.muyu.domain.resp;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.domain.CarFence;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @Author：yang
 * @Package：com.muyu.domain.resq
 * @Project：cloud-electronic
 * @name：CarFenceResq
 * @Date：2024/9/17 16:35
 */

/**
 * 车辆电子围栏类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "车辆电子围栏类")
@TableName(value = "car_fence",autoResultMap = true)
public class CarFenceResq {

    /**
     * 围栏主键
     */
    @TableId(value = "id",type = IdType.AUTO)
    @Schema(description = "围栏主键")
    private Integer id;
    /**
     * 围栏名称
     */
    @Schema(description = "围栏名称")
    private String name;
    /**
     * 业务类型名
     */
    @Schema(description = "业务类型名")
    private String clazzName;
    /**
     * 围栏类型名
     */
    @Schema(description = "围栏类型名")
    private String typeName;
    /**
     * 围栏开始时间
     */
    @Schema(description = "围栏开始时间")
    @DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date fenceStart;
    /**
     * 围栏结束时间
     */
    @Schema(description = "围栏结束时间")
    @DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date fenceEnd;
    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date fenceCreate;

    public static CarFenceResq carFenceResqListBuilder(CarFence etlDataScore) {
        return CarFenceResq.builder()
                .id(etlDataScore.getId())
                .name(etlDataScore.getName())
                .clazzName(etlDataScore.getClazzName())
                .typeName(etlDataScore.getTypeName())
                .fenceStart(etlDataScore.getFenceStart())
                .fenceEnd(etlDataScore.getFenceEnd())
                .fenceCreate(etlDataScore.getFenceCreate())
                .build();
    }
}
