use super::*;

use std::cmp::Ordering;


pub struct DirectoryChild {
    pub path: BedrockFilePath,
    pub entry_type: EntryType,
}


// ---------------------------------------------------------------------------

impl PartialEq for DirectoryChild {
    fn eq(&self, other: &Self) -> bool {
        self.entry_type == other.entry_type && self.path == other.path
    }
}

impl Eq for DirectoryChild {}

impl PartialOrd for DirectoryChild {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        Some(self.cmp(other))
    }
}

impl Ord for DirectoryChild {
    fn cmp(&self, other: &Self) -> Ordering {
        match self.entry_type.cmp(&other.entry_type) {
            Ordering::Equal => self.path.cmp(&other.path),
            ordering => ordering,
        }
    }
}