package com.sifang.modules.taskdispatch.vo;

import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.sunshine.SystemSetting.entity.CrmPlatformEmployee;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Objects;

public class GroupMemberInfo {

    private final CrmPlatformEmployee employee;
    private final List<Record> groupMember;

    public GroupMemberInfo(CrmPlatformEmployee employee, List<Record> groupMember) {
        this.employee = employee;
        this.groupMember = groupMember;
    }

    public CrmPlatformEmployee getEmployee() {
        return employee;
    }

    public List<Record> getGroupMembers() {
        return groupMember;
    }

    public boolean isLeader() {
        if (CollectionUtils.isEmpty(groupMember)) {
            return false;
        }
        for (Record record : groupMember) {
            if (Objects.equals(record.getStr("leadership"), "1")) {
                return true;
            }
        }
        return false;
    }
}
