use serde::{Deserialize, Serialize};

use crate::cmd::oid::ObjectId;

pub mod resolve_tree;
pub mod tree_entry;
pub mod tree_entry_by_path_from_commit;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TreeInfo {
    pub oid: ObjectId,
    pub entry_count: usize,
    pub is_empty: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TreeEntry {
    pub name: String,
    pub oid: ObjectId,
    pub kind: TreeKind,
    pub filemode: u32,
    pub is_binary: bool,
    pub is_lfs: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum TreeKind {
    #[serde(rename = "blob")]
    Blob,
    #[serde(rename = "tree")]
    Tree,
    #[serde(rename = "lfs_pointer")]
    LfsPointer,
}
