use super::{Category, Risk, Rule, RuleKind};

pub fn rules() -> Vec<Rule> {
    vec![
        Rule {
            id: "xcode-derived".into(),
            name: "Xcode DerivedData".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/Library/Developer/Xcode/DerivedData".into()],
            },
            risk: Risk::Safe,
            description: "Xcode build intermediates. Rebuilt automatically on next build.".into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "xcode-archives".into(),
            name: "Xcode Archives".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/Library/Developer/Xcode/Archives".into()],
            },
            risk: Risk::Caution,
            description: "Xcode build archives. May contain signed release builds you need.".into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "xcode-app-cache".into(),
            name: "Xcode app cache".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/Library/Caches/com.apple.dt.Xcode".into()],
            },
            risk: Risk::Safe,
            description:
                "Xcode editor indexes, thumbnails, and module cache. Xcode will re-index on next open."
                    .into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "xcode-simulator-caches".into(),
            name: "CoreSimulator caches".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/Library/Developer/CoreSimulator/Caches".into()],
            },
            risk: Risk::Safe,
            description:
                "iOS/watchOS/tvOS Simulator runtime caches. Regenerated by the simulator on demand."
                    .into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "xcode-device-support".into(),
            name: "Xcode Device Support".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec![
                    "~/Library/Developer/Xcode/iOS DeviceSupport".into(),
                    "~/Library/Developer/Xcode/watchOS DeviceSupport".into(),
                    "~/Library/Developer/Xcode/tvOS DeviceSupport".into(),
                    "~/Library/Developer/Xcode/macOS DeviceSupport".into(),
                    "~/Library/Developer/Xcode/visionOS DeviceSupport".into(),
                ],
            },
            risk: Risk::Caution,
            description:
                "Debug symbols pulled from physical devices. Re-downloaded next time you connect \
                 each device (5–15 min per device). Can be many GB."
                    .into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "system-logs".into(),
            name: "User logs".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/Library/Logs".into()],
            },
            risk: Risk::Safe,
            description: "Application and system log files.".into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "trash".into(),
            name: "Trash".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/.Trash".into()],
            },
            risk: Risk::Safe,
            description: "Items already in the Trash. Equivalent to 'Empty Trash'.".into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "quicklook-thumbnails".into(),
            name: "QuickLook thumbnails".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/Library/Caches/com.apple.QuickLookDaemon".into()],
            },
            risk: Risk::Safe,
            description: "macOS QuickLook preview thumbnail cache. Regenerated on demand.".into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "ios-device-backups".into(),
            name: "iOS/iPadOS device backups".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/Library/Application Support/MobileSync/Backup".into()],
            },
            risk: Risk::Caution,
            description:
                "Finder/iTunes backups of iPhones and iPads. Can be tens of GB per device. \
                 DELETING IS DESTRUCTIVE — you will lose the ability to restore these devices from backup."
                    .into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "ios-ipsw-updates".into(),
            name: "iOS/iPadOS software updates".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec![
                    "~/Library/iTunes/iPhone Software Updates".into(),
                    "~/Library/iTunes/iPad Software Updates".into(),
                ],
            },
            risk: Risk::Caution,
            description:
                "Downloaded iOS/iPadOS firmware images (IPSW). Used by Finder for device restore — \
                 will be re-downloaded next time you restore a device."
                    .into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "xcode-device-logs".into(),
            name: "Xcode iOS Device Logs".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPath {
                paths: vec!["~/Library/Developer/Xcode/iOS Device Logs".into()],
            },
            risk: Risk::Safe,
            description: "Syslogs pulled from connected iOS devices. Regenerated on next device connection."
                .into(),
            clean_command: None,
            profile_id: None,
        },
        Rule {
            id: "macos-installer-apps".into(),
            name: "macOS installer apps".into(),
            category: Category::SystemJunk,
            kind: RuleKind::KnownPathGlob {
                parent: "/Applications".into(),
                name_pattern: "Install macOS*.app".into(),
            },
            risk: Risk::Caution,
            description:
                "Full macOS installer app bundles (e.g., 'Install macOS Sequoia.app'). \
                 Typically 15+ GB each. Re-downloadable from the App Store, but required \
                 for creating bootable installers."
                    .into(),
            clean_command: None,
            profile_id: None,
        },
    ]
}
