use crate::types::{Duplicate, FileDescriptorWithPaths};

pub enum WorkResponse {
    PartitionedDuplicates(Vec<Duplicate>),
    FoundWork(Vec<DuplicateInvestigation>),
}

pub enum WorkRequest {
    Differentiate(DuplicateInvestigation),
}

pub struct DuplicateInvestigation {
    pub offset: Option<u64>,
    pub duplicate: Duplicate,
}

impl DuplicateInvestigation {
    pub fn new(duplicate: Duplicate) -> Self {
        DuplicateInvestigation {
            offset: None,
            duplicate,
        }
    }
}

#[derive(Debug, Eq, PartialEq)]
pub struct OngoingDuplicate {
    pub offset: u64,
    pub locations: Vec<FileDescriptorWithPaths>,
    pub file_size: u64,
}

#[derive(Debug)]
pub enum AnalysisMessage {
    Update(AnalysisStatistics),
    Finished(AnalysisStatistics),
}

#[derive(Debug)]
pub struct AnalysisStatistics {
    pub total_completed_investigations: u64,
    pub total_duplicates_found: u64,
    pub total_suspected_duplicates: u64,
    pub max_duplicate_size: u64,
    pub total_duplicate_size: u64,
}
