package com.hz.pm.api.user.model.dto;

import com.hz.pm.api.user.model.enumeration.UnitUserNodeType;
import com.ningdatech.basic.model.ITree;
import lombok.Data;

import java.util.Comparator;
import java.util.List;

/**
 * <p>
 * MhUnitTreeDTO
 * </p>
 *
 * @author WendyYang
 * @since 15:29 2024/1/10
 */
@Data
public class MhUnitUserTreeDTO implements ITree<String, MhUnitUserTreeDTO> {

    private String id;

    private String parentId;

    private String name;

    private Long bizId;

    private UnitUserNodeType type;

    private Short sort;

    private List<MhUnitUserTreeDTO> children;

    @Override
    public Comparator<? super MhUnitUserTreeDTO> comparator() {
        return Comparator.comparing(MhUnitUserTreeDTO::getType, Comparator.reverseOrder())
                .thenComparing(MhUnitUserTreeDTO::getSort);
    }

}
