use std::collections::{BTreeMap, HashMap};
use std::path::PathBuf;
use std::time::Instant;
use crate::extraction::index::ScopeIgnore;
use super::backend::WatchHandle;
use super::types::{
DegradedCallback, FileSnapshot, PendingInfo, ScheduledSyncKind, SyncCompleteCallback,
SyncErrorCallback, SyncFn,
};
pub struct FileWatcher {
pub(super) recursive_watcher: Option<Box<dyn WatchHandle>>,
pub(super) dir_watchers: HashMap<PathBuf, Box<dyn WatchHandle>>,
pub(super) dir_cap_warned: bool,
pub(super) inotify_limit_warned: bool,
pub(super) degraded_reason: Option<String>,
pub(super) lock_retry_count: usize,
pub(super) inert: bool,
pub(super) scheduled_at: Option<Instant>,
pub(super) scheduled_delay_ms: Option<u64>,
pub(super) scheduled_kind: Option<ScheduledSyncKind>,
pub(super) debounce_started_at: Option<Instant>,
pub(super) pending_files: BTreeMap<String, PendingInfo>,
pub(super) poll_snapshot: BTreeMap<String, FileSnapshot>,
pub(super) last_poll_at: Option<Instant>,
pub(super) poll_interval_ms: u64,
pub(super) sync_started_ms: i64,
pub(super) syncing: bool,
pub(super) last_sync_finished_at: Option<Instant>,
pub(super) min_sync_interval_ms: u64,
pub(super) max_debounce_ms: u64,
pub(super) stopped: bool,
pub(super) ready: bool,
pub(super) ignore_matcher: Option<ScopeIgnore>,
pub(super) project_root: PathBuf,
pub(super) debounce_ms: u64,
pub(super) sync_fn: SyncFn,
pub(super) on_sync_complete: Option<SyncCompleteCallback>,
pub(super) on_sync_error: Option<SyncErrorCallback>,
pub(super) on_degraded: Option<DegradedCallback>,
pub(super) inert_for_tests: bool,
}