import Foundation

struct AuthCredentials: Codable, Sendable {
    let password: String

    init(password: String) {
        self.password = password
    }
}

struct XStreamCredentials: Codable, Sendable {
    let baseURL: String
    let username: String
    let password: String

    func constructPlaylistURL(path: String = "/get.php") -> URL? {
        guard let base = URL(string: baseURL) else { return nil }
        let fullURL = base.appendingPathComponent(path)
        return fullURL.appendingXStreamParameters(
            username: username,
            password: password,
            type: Constants.API.xstreamPlaylistType,
            output: Constants.API.xstreamOutputFormat
        )
    }

    init(baseURL: String, username: String, password: String) {
        self.baseURL = baseURL
        self.username = username
        self.password = password
    }
}
