package com.agri.system.domain;

import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
import com.agri.common.core.domain.entity.SysUser;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 大棚信息（用户-设备关联）对象 sys_user_agri
 * 
 * @author lld
 * @date 2026-01-25
 */
@TableName("sys_user_agri")
public class SysUserAgri extends BaseEntity
{
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /** 主键ID（雪花） */
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /** 大棚ID */
    @Excel(name = "大棚ID")
    private String agriId;

    /** 协同用户ID */
    @Excel(name = "协同用户ID")
    private Long userId;

    /** 角色：3-OWNER/2-ADMIN/1-OPERATOR/0-VIEWER */
    @Excel(name = "角色：3-OWNER/2-ADMIN/1-OPERATOR/0-VIEWER")
    private Integer role;

    /** 权限位（位运算）：1=查看 2=控制 4=配置 8=分享/成员管理 16=导出等 */
    @Excel(name = "权限位", readConverterExp = "位=运算")
    private Integer permMask;

    /** 状态：0=禁用 1=启用 2=待接受邀请 */
    @Excel(name = "状态：0=禁用 1=启用 2=待接受邀请")
    private Integer status;

    /** 邀请人用户ID */
    @Excel(name = "邀请人用户ID")
    private Long inviteBy;

    /** 邀请时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Excel(name = "邀请时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date inviteTime;

    /** 接受时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Excel(name = "接受时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date acceptTime;

    /** 版本号（乐观锁） */
    @Excel(name = "版本号", readConverterExp = "乐=观锁")
    @Version
    private Integer version;

    @TableField(exist = false)
    private SysUser sysUser;

    @TableField(exist = false)
    private String imei;

    @TableField(exist = false)
    private Boolean disabled;

    public Boolean getDisabled() {
        return disabled;
    }

    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }

    public void setAgriId(String agriId)
    {
        this.agriId = agriId;
    }

    public String getAgriId()
    {
        return agriId;
    }

    public void setUserId(Long userId) 
    {
        this.userId = userId;
    }

    public Long getUserId() 
    {
        return userId;
    }

    public void setRole(Integer role)
    {
        this.role = role;
    }

    public Integer getRole()
    {
        return role;
    }


    public void setStatus(Integer status)
    {
        this.status = status;
    }

    public Integer getStatus()
    {
        return status;
    }

    public void setInviteBy(Long inviteBy) 
    {
        this.inviteBy = inviteBy;
    }

    public Long getInviteBy() 
    {
        return inviteBy;
    }

    public void setInviteTime(Date inviteTime) 
    {
        this.inviteTime = inviteTime;
    }

    public Date getInviteTime() 
    {
        return inviteTime;
    }

    public void setAcceptTime(Date acceptTime) 
    {
        this.acceptTime = acceptTime;
    }

    public Date getAcceptTime() 
    {
        return acceptTime;
    }

    public Integer getPermMask() {
        return permMask;
    }

    public void setPermMask(Integer permMask) {
        this.permMask = permMask;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("agriId", getAgriId())
            .append("sysUser", getSysUser())
            .append("userId", getUserId())
            .append("role", getRole())
            .append("permMask", getPermMask())
            .append("status", getStatus())
            .append("inviteBy", getInviteBy())
            .append("inviteTime", getInviteTime())
            .append("acceptTime", getAcceptTime())
            .append("remark", getRemark())
            .append("createTime", getCreateTime())
            .append("createBy", getCreateBy())
            .append("updateTime", getUpdateTime())
            .append("updateBy", getUpdateBy())
            .append("version", getVersion())
            .toString();
    }
}
