package com.muyu.domain.resp;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.domain.CarFence;
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 CarFenceResp {

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

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