import Foundation

enum Constants {
    // MARK: - API Configuration
    enum API {
        // Web service endpoint for authentication
        // TODO: Replace with your actual web service URL
        static let authenticationBaseURL = "http://glacier.local:8000"
        static let authenticationEndpoint = "/api/v1/config"
        static let authenticationHeaderKey = "X-Password"

        // XStream API endpoints
        static let xstreamPlaylistPath = "/get.php"
        static let xstreamPlaylistType = "m3u_plus"
        static let xstreamOutputFormat = "ts"

        // Request timeouts
        static let requestTimeout: TimeInterval = 30.0
        static let downloadTimeout: TimeInterval = 60.0
    }

    // MARK: - Storage Keys
    enum Storage {
        static let keychainService = "com.simvision.tvos"
        static let credentialsKey = "xstream_credentials"
        static let userDefaultsPrefix = "simvision_"
        static let tmdbAPIKeyKey = "tmdb_api_key"
        static let tmdbCacheKey = "tmdb_recent_releases"
        static let releaseDateCacheKey = "release_date_cache"  // Persistent cache: normalizedTitle -> releaseDate
        static let tmdbTVTrendingCacheKey = "tmdb_trending_tv"
        static let tvShowAirDatesKey = "tv_show_air_dates"
    }

    // MARK: - TMDB Configuration
    enum TMDB {
        static let baseURL = "https://api.themoviedb.org/3"
        static let imageBaseURL = "https://image.tmdb.org/t/p/w500"
        static let discoverPath = "/discover/movie"
        static let searchPath = "/search/movie"
        static let cacheTTL: TimeInterval = 6 * 60 * 60  // 6 hours
        static let maxDisplayCount = 20
        static let maxTotalCount = 100
        // Release types: 1=Premiere, 2=Theatrical Limited, 3=Theatrical, 4=Digital, 5=Physical, 6=TV
        static let digitalReleaseType = "4"

        // TV endpoints
        static let tvTrendingPath = "/trending/tv/week"
        static let tvDetailsPath = "/tv"  // /tv/{id}
        static let tvSearchPath = "/search/tv"
        static let tvMaxDisplayCount = 10
        static let recentAirDateDays = 14  // Shows with episodes in last 14 days
    }

    // MARK: - UI Configuration
    enum UI {
        // Grid layout
        static let vodGridColumns = 4
        static let vodGridSpacing: CGFloat = 80  // Increased to prevent focus overlap
        static let vodCardCornerRadius: CGFloat = 12

        // Focus effects
        static let focusScale: CGFloat = 1.05  // Reduced from 1.08 for subtler effect
        static let focusShadowRadius: CGFloat = 25
        static let focusBorderWidth: CGFloat = 6

        // Animation durations
        static let standardAnimationDuration: Double = 0.25
    }

    // MARK: - App Information
    enum App {
        static let name = "SimVision"
        static let version = "1.0.0"
    }
}
