package com.ruoyi.common.core.domain;

import com.ruoyi.mall.domain.MallRegion;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

public class RegionTreeSelect implements Serializable {

    private static final long serialVersionUID = 1L;

    private String value;

    private String label;

    private List<RegionTreeSelect> children;

    public RegionTreeSelect() {
    }

    public RegionTreeSelect(MallRegion mallRegion) {
        this.value = mallRegion.getName();
        this.label = mallRegion.getName();
        if (mallRegion.getChildren().size() > 0){
            this.children = mallRegion.getChildren().stream().map(RegionTreeSelect::new).collect(Collectors.toList());
        }
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public List<RegionTreeSelect> getChildren() {
        return children;
    }

    public void setChildren(List<RegionTreeSelect> children) {
        this.children = children;
    }
}
