use serde::{Deserialize, Serialize};

use crate::log::LogEntry;

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum RaftMessage {
    AppendEntriesRequest {
        term: u64,
        leader_id: u64,
        prev_log_index: u64,
        prev_log_term: u64,
        entries: Vec<LogEntry>,
        leader_commit: u64,
    },
    AppendEntriesResponse {
        term: u64,
        success: bool,
        match_index: u64,
    },
    RequestVoteRequest {
        term: u64,
        candidate_id: u64,
        last_log_index: u64,
        last_log_term: u64,
    },
    RequestVoteResponse {
        term: u64,
        vote_granted: bool,
    },
}
