package com.ruoyi.dz.domain;

import com.ruoyi.common.core.domain.entity.SysDept;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.TreeEntity;

import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * 机构代理对象 dz_agent
 *
 * @author ruoyi
 * @date 2025-09-12
 */
public class DzAgent extends TreeEntity
{
    private static final long serialVersionUID = 1L;

    /** 代理商名称 */
    @Excel(name = "姓名")
    private String name;

    /** 代理商ID */
    @Excel(name = "账号")
    private Long agentId;

    /** 上级代理商ID */
    private Long parentId;
    /** 机构ID */
//    @Excel(name = "机构ID")
    private Long deptId;

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



    /** 联系电话 */
//    @Excel(name = "联系电话")
    private String phonenumber;

    /** 负责校区列表 */
//    @Excel(name = "负责校区列表")
    private String schools;
    private Long[] schoolIds;
    private String schoolName;

    private String username;
    private String invitationCode;

    /** 密码 */
    @Excel(name = "密码")
    private String password2;
    private String status;
    /** 机构名称 */
    @Excel(name = "机构名称")
    private String deptName;
    private SysDept dept;

    private Long teacherId;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
    public String getInvitationCode() {
        return invitationCode;
    }

    public void setInvitationCode(String invitationCode) {
        this.invitationCode = invitationCode;
    }

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public Long[] getSchoolIds() {
        return (null==schoolIds||schoolIds.length==0)?(StringUtils.isNotEmpty(schools)?
                Arrays.stream(schools.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).toArray(Long[]::new):new Long[0]):schoolIds;
    }

    public void setSchoolIds(Long[] schoolIds) {
        this.schoolIds = schoolIds;
    }

    public SysDept getDept() {
        return dept;
    }

    public void setDept(SysDept dept) {
        this.dept = dept;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword2() {
        return password2;
    }

    public void setPassword2(String password2) {
        this.password2 = password2;
    }

    public void setAgentId(Long agentId)
    {
        this.agentId = agentId;
    }

    public Long getAgentId()
    {
        return agentId;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

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

    public Long getUserId()
    {
        return userId;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }

    public void setPhonenumber(String phonenumber)
    {
        this.phonenumber = phonenumber;
    }

    public String getPhonenumber()
    {
        return phonenumber;
    }

    public void setSchools(String schools)
    {
        this.schools = schools;
    }

    public String getSchools()
    {
        return schools;
    }

    @Override
    public Long getParentId() {
        return parentId;
    }

    @Override
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(Long teacherId) {
        this.teacherId = teacherId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("agentId", getAgentId())
            .append("userId", getUserId())
            .append("name", getName())
            .append("phonenumber", getPhonenumber())
            .append("parentId", getParentId())
            .append("schools", getSchools())
            .append("remark", getRemark())
            .toString();
    }
}
