//
//  URLs.swift
//  PadelClub
//
//  Created by Laurent Morvillier on 22/04/2024.
//

import Foundation

enum URLs: String, Identifiable {
//    case httpScheme = "https://"
#if DEBUG
    case activationHost = "xlr.alwaysdata.net"
    case main = "https://xlr.alwaysdata.net/"
//    case api = "https://xlr.alwaysdata.net/roads/"
#elseif TESTFLIGHT
    case activationHost = "xlr.alwaysdata.net"
    case main = "https://xlr.alwaysdata.net/"
//    case api = "https://xlr.alwaysdata.net/roads/"
#elseif PRODTEST
    case activationHost = "padelclub.app"
    case main = "https://padelclub.app/"
//    case api = "https://padelclub.app/roads/"
#else
    case activationHost = "padelclub.app"
    case main = "https://padelclub.app/"
//    case api = "https://padelclub.app/roads/"
#endif

    case subscriptions = "https://apple.co/2Th4vqI"
    case beachPadel = "https://beach-padel.app.fft.fr/beachja/index/"
    //case padelClub = "https://padelclub.app"
    case tenup = "https://tenup.fft.fr"
    case padelCompetitionGeneralGuide = "https://padelclub.app/static/rules/padel-guide-general.pdf"
    case padelCompetitionSpecificGuide = "https://padelclub.app/static/rules/padel-guide-cdc.pdf"
    case padelCompetitionRankingGuide = "https://padelclub.app/static/rules/padel-guide-rankings.pdf"
    case padelRules = "https://padelclub.app/static/rules/padel-rules.pdf"
    case restingDischarge = "https://club.fft.fr/tennisfirmidecazeville/60120370_d/data_1/pdf/fo/formlairededechargederesponsabilitetournoidepadel.pdf"
    case appReview = "https://apps.apple.com/app/padel-club/id6484163558?mt=8&action=write-review"
    case appDescription = "https://padelclub.app/download/"
    case instagram = "https://www.instagram.com/padelclub.app?igsh=bmticnV5YWhpMnBn"
    case appStore = "https://apps.apple.com/app/padel-club/id6484163558"
    case eula = "https://www.apple.com/legal/internet-services/itunes/dev/stdeula/"
    case privacy = "https://padelclub.app/terms-of-use"
    
    var id: String { return self.rawValue }
    
    var url: URL {
        return URL(string: self.rawValue)!
    }
    
    func extend(path: String) -> URL {
        return URL(string: self.rawValue + path)!
    }
    
}

enum PageLink: String, Identifiable, CaseIterable {
    case info = "Informations"
    case teams = "Équipes"
    case summons = "Convocations"
    case groupStages = "Poules"
    case matches = "Tournoi"
    case rankings = "Classement"
    case broadcast = "Mode TV (Tournoi)"
    case clubBroadcast = "Mode TV (Club)"
    
    var id: String { self.rawValue }
    
    func localizedLabel() -> String {
        rawValue
    }
    
    var path: String {
        switch self {
        case .matches:
            return ""
        case .info:
            return "info"
        case .teams:
            return "teams"
        case .summons:
            return "summons"
        case .rankings:
            return "rankings"
        case .groupStages:
            return "group-stages"
        case .broadcast:
            return "broadcast"
        case .clubBroadcast:
            return ""
        }
    }
}

