using System.Text.Json.Serialization;

namespace CalledIt.Seeder;

// Models matching the football-data.org v4 API response shape.
// Used for both local JSON files and live API calls.

public sealed record FootballDataResponse(
    [property: JsonPropertyName("competition")] FootballDataCompetition Competition,
    [property: JsonPropertyName("resultSet")] FootballDataResultSet ResultSet,
    [property: JsonPropertyName("matches")] FootballDataMatch[] Matches
);

public sealed record FootballDataCompetition(
    [property: JsonPropertyName("id")] int Id,
    [property: JsonPropertyName("name")] string Name,
    [property: JsonPropertyName("code")] string Code,
    [property: JsonPropertyName("emblem")] string? Emblem
);

public sealed record FootballDataResultSet(
    [property: JsonPropertyName("first")] string First,
    [property: JsonPropertyName("last")] string Last
);

public sealed record FootballDataMatch(
    [property: JsonPropertyName("utcDate")] string UtcDate,
    [property: JsonPropertyName("status")] string Status,
    [property: JsonPropertyName("stage")] string Stage,
    [property: JsonPropertyName("group")] string? Group,
    [property: JsonPropertyName("homeTeam")] FootballDataTeam HomeTeam,
    [property: JsonPropertyName("awayTeam")] FootballDataTeam AwayTeam,
    [property: JsonPropertyName("score")] FootballDataScore Score
);

public sealed record FootballDataTeam(
    [property: JsonPropertyName("id")] int? Id,
    [property: JsonPropertyName("name")] string? Name,
    [property: JsonPropertyName("crest")] string? Crest
);

public sealed record FootballDataScore(
    [property: JsonPropertyName("fullTime")] FootballDataScoreValue FullTime
);

public sealed record FootballDataScoreValue(
    [property: JsonPropertyName("home")] int? Home,
    [property: JsonPropertyName("away")] int? Away
);
