package com.muyu.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.domain.req.FenceGroupUpdateReq;
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;

/**
 * 围栏组实体类
 *  * @Author：yan
 *  * @Package：com.muyu.car.domain
 *  * @Project：cars
 *  * @name：FenceGroup
 *  * @Date：2024/9/21 20:45
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "车辆电子围栏中间表")
@TableName(value = "fence_group",autoResultMap = true)
public class FenceGroup {
    /**
     * id
     */
    @TableId(value = "group_id",type = IdType.AUTO)
    @Schema(name = "围栏组id")
    private Long  groupId;
    /**
     * 围栏组名称
     */
    @Schema(name = "围栏组名称")
    private String groupName;
    /**
     * 围栏组状态
     */
    @Schema(name = "围栏组状态")
    private Integer  groupStates;

    public static FenceGroup carFenceUpdateById(Integer states, FenceGroupUpdateReq fenceGroupBuilder ){
        return FenceGroup.builder()
                .groupId(fenceGroupBuilder.getGroupId())
                .groupStates(states)
                .build();
    }

    public static FenceGroup closeCarFenceUpdateById(Integer states, Long groupId ){
        return FenceGroup.builder()
                .groupId(groupId)
                .groupStates(states)
                .build();
    }
}
