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.common.core.web.domain.BaseEntity;
import com.muyu.domain.req.FenceGroupAddReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 围栏组表
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "fence_group", autoResultMap = true)
public class FenceGroup extends BaseEntity {

    /**
     * 主键
     */
    @TableId(value = "fence_group_id" ,type = IdType.AUTO)
    @Schema(type = "Long",description = "围栏组id")
    private Long fenceGroupId;

    /**
     * 优先级
     */
    @Schema(type = "String",description = "优先级")
    private String priority;

    /**
     * 状态 0:启用 1:禁止
     */
    @Schema(type = "Integer",description = "状态 0:启用 1:禁止")
    private Integer status;

    /**
     * 围栏组类型
     */
    @Schema(type = "String",description = "围栏组类型")
    private String groupType;

    //添加
    public static FenceGroup build(FenceGroupAddReq req){
        return FenceGroup.builder()
                .priority(req.getPriority())
                .groupType(req.getGroupType())
                .status(req.getStatus())
                .build();
    }

    /**
     * 电子围栏id
     */
    @Schema(type = "Long",description = "电子围栏id")
    private Long fenceId;

    /**
     * 围栏名称
     */
    @Schema(type = "String",description = "围栏名称")
    private String fenceName;


}
