use serde::{Deserialize, Serialize};

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

pub mod commit_cherry_pick;
pub mod commit_create;
pub mod commit_history;
pub mod commit_info;
pub mod commit_prefix;
pub mod commit_refs;
pub mod commit_summary;
pub mod commit_walker;
pub use commit_cherry_pick::{
    CommitCherryPickParams, CommitCherryPickSequence,
};
pub use commit_create::{CreateCommitParams, FileChange};
pub use commit_summary::CommitSummary;
pub use commit_walker::{CommitWalkParams, CommitWalkSort};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommitSignature {
    pub name: String,
    pub email: String,
    pub time_secs: i64,
    pub offset_minutes: i32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommitMeta {
    pub oid: ObjectId,
    pub message: String,
    pub summary: String,
    pub author: CommitSignature,
    pub committer: CommitSignature,
    pub tree_id: ObjectId,
    pub parent_ids: Vec<ObjectId>,
    pub encoding: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommitRefInfo {
    pub name: String,
    pub target: ObjectId,
    pub is_remote: bool,
    pub is_tag: bool,
}
