//
//  Team.swift
//  SportsTime
//

import Foundation

struct Team: Identifiable, Codable, Hashable {
    let id: UUID
    let name: String
    let abbreviation: String
    let sport: Sport
    let city: String
    let stadiumId: UUID
    let logoURL: URL?
    let primaryColor: String?
    let secondaryColor: String?

    init(
        id: UUID,
        name: String,
        abbreviation: String,
        sport: Sport,
        city: String,
        stadiumId: UUID,
        logoURL: URL? = nil,
        primaryColor: String? = nil,
        secondaryColor: String? = nil
    ) {
        self.id = id
        self.name = name
        self.abbreviation = abbreviation
        self.sport = sport
        self.city = city
        self.stadiumId = stadiumId
        self.logoURL = logoURL
        self.primaryColor = primaryColor
        self.secondaryColor = secondaryColor
    }

    var fullName: String {
        "\(city) \(name)"
    }
}

extension Team: Equatable {
    static func == (lhs: Team, rhs: Team) -> Bool {
        lhs.id == rhs.id
    }
}
