package com.ruoyi.web.base.domain.param;

import java.util.*;

public class TreeNode {
    public enum NodeType { LINE, MARKET, CUSTOMER }
    
    private final NodeType nodeType;
    private final String num;
    private final String name;
    private final List<TreeNode> children = new ArrayList<>();
    private final Set<String> allCustomerNums = new HashSet<>();

    public TreeNode(NodeType nodeType, String num, String name) {
        this.nodeType = nodeType;
        this.num = num;
        this.name = name;
    }

    public void addChild(TreeNode child) {
        children.add(child);
    }

    // Getter方法
    public NodeType getNodeType() { return nodeType; }
    public String getNum() { return num; }
    public String getName() { return name; }
    public List<TreeNode> getChildren() { return children; }
    public Set<String> getAllCustomerNums() { return allCustomerNums; }
    
    public void addCustomerNum(String num) {
        allCustomerNums.add(num);
    }
    
    public void addAllCustomerNums(Collection<String> nums) {
        allCustomerNums.addAll(nums);
    }

    @Override
    public String toString() {
        return "TreeNode{" +
                "nodeType=" + nodeType +
                ", num='" + num + '\'' +
                ", name='" + name + '\'' +
                ", children=" + children +
                ", allCustomerNums=" + allCustomerNums +
                '}';
    }
}