bkr 1.0.0

Backup and restore tool for syncing files to AWS S3 with native zstd compression
Documentation
/// Metadata file names used by Baker
pub mod metadata_files {
    pub const SOURCE: &str = ".source.baker.yml";
    pub const ARCHIVES: &str = ".archives.metadata.baker.yml";
    pub const TIMESTAMP: &str = ".baker-timestamp.yml";
}

/// Archive format
pub const ARCHIVE_EXTENSION: &str = ".tar.zst";

/// Version
pub const BAKER_VERSION: &str = "1.0.0";

/// Zstd compression limits
pub mod zstd {
    pub const MIN_LEVEL: i32 = 1;
    pub const MAX_LEVEL: i32 = 22;
}

/// Default paths
pub mod paths {
    pub const AWS_CREDENTIALS: &str = "~/.aws/credentials";
    pub const DEFAULT_CONFIG: &str = "~/.config/bkr/config.yml";
    pub const CONFIG_SEARCH: &[&str] = &[
        "~/.config/bkr/config.yml",      // Primary XDG-compliant location
        "~/.config/bkr/backup.conf.yml",
        "./backup.conf.yml",
        "./config.yml",
    ];
    pub const RESTORE_TEMPLATE: &str = "~/.backups";
}

/// System files to always ignore
pub const SYSTEM_IGNORE_FILES: &[&str] = &[".DS_Store", "Thumbs.db", "desktop.ini"];

/// Baker metadata patterns to ignore during restore
pub const METADATA_IGNORE_PATTERNS: &[&str] = &["**/.baker-*.yml", "**/*.baker.yml"];

/// S3 content types
pub mod content_types {
    pub const OCTET_STREAM: &str = "application/octet-stream";
    pub const YAML: &str = "application/x-yaml";
}

/// UI formatting
pub mod ui {
    pub const SEPARATOR_WIDTH: usize = 60;
}

/// Default configuration values
pub mod defaults {
    pub const AWS_REGION: &str = "us-east-1";
    pub const ZSTD_LEVEL: i32 = 3;
    pub const BACKUP_AGE_WARNING_DAYS: i64 = 7;
    pub const TIMEZONE: &str = "America/Los_Angeles";
}

/// Time constants
pub mod time {
    pub const SECONDS_PER_MINUTE: u64 = 60;
    pub const SECONDS_PER_HOUR: u64 = 3600;
    pub const SECONDS_PER_DAY: u64 = 86400;
    pub const MS_PER_DAY: u64 = 1000 * 60 * 60 * 24;
}

/// Windows scheduled task names
pub mod windows_tasks {
    pub const BACKUP: &str = "BakerBackup";
    pub const RESTORE: &str = "BakerRestore";
}

/// Default configuration template
pub const CONFIG_TEMPLATE: &str = r#"# bkr configuration file
# Documentation: https://github.com/goodwokdev/flow-bkr

storage:
  profile: default           # AWS profile name (~/.aws/credentials)
  region: us-west-2          # AWS region
  bucket:
    name: my-backup-bucket   # S3 bucket name
    prefix: my-workstation   # Optional prefix for all backups

  restore:
    path: ~/.backups         # Where to restore files
    bucket_prefix: ""        # Restore from bucket root (or specific prefix)

to_backup:
  # Example: backup your dotfiles
  dotfiles:
    path: ~/.config
    destination_prefix: config
    ignore:
      - "*.log"
      - "cache/"
      - "Cache/"

  # Example: backup a project with compression
  # my-project:
  #   path: ~/projects/app
  #   destination_prefix: projects
  #   ignore:
  #     - ".git"
  #     - "target/"
  #   zstd:                  # Directories to compress as .tar.zst
  #     - node_modules
  #     - dist
  #   zstd_level: 3          # Compression level (1-22, default: 3)

daemon_schedule:
  every: 1h                  # Backup interval (e.g., 30m, 1h, 6h, 1d)
  exercise_restore: false    # Also run restore on schedule
"#;

/// Backup status values
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BackupStatus {
    Success,
    Failed,
}

impl BackupStatus {
    pub fn as_str(&self) -> &'static str {
        match self {
            BackupStatus::Success => "success",
            BackupStatus::Failed => "failed",
        }
    }
}