package com.retdata.yaoyibi.domain;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class CsoSysDeptExportRecord {
    private CsoSysDeptSearchDto rootDept;
    private CsoSysDeptSearchDto firstDept;
    private CsoSysDeptSearchDto secondDept;

    public int getDepth() {
        if (secondDept != null) {
            return 2;
        } else if (firstDept != null) {
            return 1;
        } else {
            return 0;
        }
    }

    public List<Integer> getFullPath() {
        List<Integer> path = new ArrayList<>(3);
        if (rootDept != null) {
            path.add(rootDept.getDeptId());
        }
        if (firstDept != null) {
            path.add(firstDept.getDeptId());
        }
        if (secondDept != null) {
            path.add(secondDept.getDeptId());
        }
        return path;
    }
}
