using System;

namespace NerdRank
{
    [Serializable]
    public class NerdRankResult<T>
    {
        public bool Success;
        public T Value;
        public long StatusCode;
        public string Error;

        public static NerdRankResult<T> Ok(T value, long statusCode)
        {
            return new NerdRankResult<T>
            {
                Success = true,
                Value = value,
                StatusCode = statusCode
            };
        }

        public static NerdRankResult<T> Fail(string error, long statusCode)
        {
            return new NerdRankResult<T>
            {
                Success = false,
                StatusCode = statusCode,
                Error = error
            };
        }
    }

    [Serializable]
    public class LeaderboardResponse
    {
        public string id;
        public string gameId;
        public string name;
        public int type;
        public string createdAt;
        public LeaderboardEntryResponse[] entries;
    }

    [Serializable]
    public class LeaderboardEntryResponse
    {
        public string id;
        public string leaderboardId;
        public string playerName;
        public double score;
        public string userID;
        public string createdAt;
    }

    [Serializable]
    public class AddLeaderboardEntryRequest
    {
        public string playerName;
        public double score;
        public string userID;

        public AddLeaderboardEntryRequest(string playerName, double score, string userId)
        {
            this.playerName = playerName;
            this.score = score;
            userID = userId;
        }
    }
}
