import Foundation

enum AppConstants {
    // MARK: - App Info

    static let appName = "Portfolio Journal"
    static let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0"
    static let buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "1"

    // MARK: - Bundle Identifiers

    static let bundleIdentifier = "com.alexandrevazquez.portfoliojournal"
    static let appGroupIdentifier = "group.com.alexandrevazquez.portfoliojournal"
    static let cloudKitContainerIdentifier = "iCloud.com.alexandrevazquez.portfoliojournal"

    // MARK: - StoreKit

    static let premiumProductID = "com.portfoliojournal.premium"

    // MARK: - AdMob

    #if DEBUG
    static let adMobAppID = "ca-app-pub-3940256099942544~1458002511" // Test App ID
    static let bannerAdUnitID = "ca-app-pub-3940256099942544/2934735716" // Test Banner
    #else
    static let adMobAppID = "ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY" // Replace with real App ID
    static let bannerAdUnitID = "ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY" // Replace with real Ad Unit ID
    #endif

    // MARK: - Currency

    static let defaultCurrency = "EUR"
    static let currencySymbol = "€"

    // MARK: - Freemium Limits

    static let maxFreeSources = 5
    static let maxFreeHistoricalMonths = 12

    // MARK: - UI Constants

    enum UI {
        static let cornerRadius: CGFloat = 12
        static let smallCornerRadius: CGFloat = 8
        static let largeCornerRadius: CGFloat = 16

        static let padding: CGFloat = 16
        static let smallPadding: CGFloat = 8
        static let largePadding: CGFloat = 24

        static let iconSize: CGFloat = 24
        static let smallIconSize: CGFloat = 16
        static let largeIconSize: CGFloat = 32

        static let bannerAdHeight: CGFloat = 50
        static let tabBarHeight: CGFloat = 49

        static let cardShadowRadius: CGFloat = 4
        static let cardShadowOpacity: CGFloat = 0.1
    }

    // MARK: - Animation

    enum Animation {
        static let defaultDuration: Double = 0.3
        static let shortDuration: Double = 0.15
        static let longDuration: Double = 0.5
    }

    // MARK: - Charts

    enum Charts {
        static let defaultMonthsToShow = 12
        static let predictionMonths = 12
        static let minDataPointsForPrediction = 3
        static let confidenceIntervalPercentage = 0.15
    }

    // MARK: - Notifications

    enum Notifications {
        static let defaultHour = 9
        static let defaultMinute = 0
        static let categoryIdentifier = "INVESTMENT_REMINDER"
    }

    // MARK: - Storage Keys

    enum StorageKeys {
        static let onboardingCompleted = "onboardingCompleted"
        static let adConsentObtained = "adConsentObtained"
        static let lastSyncDate = "lastSyncDate"
        static let selectedCategoryFilter = "selectedCategoryFilter"
        static let preferredChartType = "preferredChartType"
    }

    // MARK: - Deep Links

    enum DeepLinks {
        static let scheme = "portfoliojournal"
        static let sourceDetail = "source"
        static let addSnapshot = "addSnapshot"
        static let premium = "premium"
    }

    // MARK: - URLs

    enum URLs {
        static let privacyPolicy = "https://portfoliojournal.app/privacy.html"
        static let termsOfService = "https://portfoliojournal.app/terms.html"
        static let support = "https://portfoliojournal.app/support.html"
        static let appStore = "https://apps.apple.com/app/idXXXXXXXXXX"
    }

    // MARK: - Feature Flags

    enum Features {
        static let enablePredictions = true
        static let enableExport = true
        static let enableWidgets = true
        static let enableNotifications = true
        static let enableAnalytics = true
    }
}

// MARK: - SF Symbols

enum SFSymbol {
    // Navigation
    static let dashboard = "chart.pie.fill"
    static let sources = "list.bullet"
    static let charts = "chart.xyaxis.line"
    static let settings = "gearshape.fill"

    // Actions
    static let add = "plus"
    static let edit = "pencil"
    static let delete = "trash"
    static let share = "square.and.arrow.up"
    static let export = "arrow.up.doc"

    // Status
    static let checkmark = "checkmark.circle.fill"
    static let warning = "exclamationmark.triangle.fill"
    static let error = "xmark.circle.fill"
    static let info = "info.circle.fill"

    // Financial
    static let trendUp = "arrow.up.right"
    static let trendDown = "arrow.down.right"
    static let money = "eurosign.circle.fill"
    static let chart = "chart.line.uptrend.xyaxis"

    // Categories
    static let stocks = "chart.line.uptrend.xyaxis"
    static let bonds = "building.columns.fill"
    static let realEstate = "house.fill"
    static let crypto = "bitcoinsign.circle.fill"
    static let cash = "banknote.fill"
    static let etf = "chart.bar.fill"
    static let retirement = "person.fill"
    static let other = "ellipsis.circle.fill"

    // Premium
    static let premium = "crown.fill"
    static let lock = "lock.fill"
    static let unlock = "lock.open.fill"

    // Misc
    static let calendar = "calendar"
    static let notification = "bell.fill"
    static let refresh = "arrow.clockwise"
    static let close = "xmark"
}
