VanguardReMaster/client/Assets/Vanguard/Runtime/Api/ApiContracts.cs

289 lines
13 KiB
C#

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Vanguard.Shared.Protocol;
namespace Vanguard.Api.Contracts
{
public sealed class LoginRequest
{
[JsonProperty("userName")] public string UserName { get; set; } = string.Empty;
[JsonProperty("password")] public string Password { get; set; } = string.Empty;
}
public sealed class RegisterRequest
{
[JsonProperty("userName")] public string UserName { get; set; } = string.Empty;
[JsonProperty("password")] public string Password { get; set; } = string.Empty;
}
public sealed class RefreshRequest
{
[JsonProperty("refreshToken")] public string RefreshToken { get; set; } = string.Empty;
}
public sealed class AuthResponse
{
[JsonProperty("userId")] public Guid UserId { get; set; }
[JsonProperty("userName")] public string UserName { get; set; } = string.Empty;
[JsonProperty("accessToken")] public string AccessToken { get; set; } = string.Empty;
[JsonProperty("refreshToken")] public string RefreshToken { get; set; } = string.Empty;
[JsonProperty("accessExpiresAt")] public DateTimeOffset AccessExpiresAt { get; set; }
[JsonProperty("refreshExpiresAt")] public DateTimeOffset RefreshExpiresAt { get; set; }
[JsonProperty("onboardingCompleted")] public bool OnboardingCompleted { get; set; }
}
public sealed class MeResponse
{
[JsonProperty("userId")] public Guid UserId { get; set; }
[JsonProperty("userName")] public string UserName { get; set; } = string.Empty;
[JsonProperty("createdAt")] public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("onboardingCompleted")] public bool OnboardingCompleted { get; set; }
[JsonProperty("selectedTrialDeckId")] public string SelectedTrialDeckId { get; set; }
[JsonProperty("gold")] public int Gold { get; set; }
[JsonProperty("dust")] public int Dust { get; set; }
[JsonProperty("tokens")] public int Tokens { get; set; }
[JsonProperty("xp")] public int Xp { get; set; }
[JsonProperty("rankedMmr")] public int RankedMmr { get; set; }
[JsonProperty("casualMmr")] public int CasualMmr { get; set; }
[JsonProperty("matches")] public int Matches { get; set; }
[JsonProperty("wins")] public int Wins { get; set; }
}
public sealed class ApiErrorDto
{
[JsonProperty("error")] public string Error { get; set; } = string.Empty;
[JsonProperty("message")] public string Message { get; set; } = string.Empty;
[JsonProperty("violations")] public List<ApiViolationDto> Violations { get; set; }
}
public sealed class ApiViolationDto
{
[JsonProperty("code")] public string Code { get; set; } = string.Empty;
[JsonProperty("message")] public string Message { get; set; } = string.Empty;
}
public sealed class QueueRequest
{
[JsonProperty("mode")] public string Mode { get; set; } = "classic-ranked";
[JsonProperty("deckId")] public Guid? DeckId { get; set; }
}
public sealed class QueueAccepted
{
[JsonProperty("queueId")] public Guid QueueId { get; set; }
[JsonProperty("status")] public string Status { get; set; } = string.Empty;
[JsonProperty("mode")] public string Mode { get; set; } = string.Empty;
}
public sealed class QueueStatusResponse
{
[JsonProperty("queueId")] public Guid QueueId { get; set; }
[JsonProperty("status")] public string Status { get; set; } = string.Empty;
[JsonProperty("mode")] public string Mode { get; set; } = string.Empty;
[JsonProperty("waitedSeconds")] public int WaitedSeconds { get; set; }
[JsonProperty("window")] public int Window { get; set; }
[JsonProperty("matchId")] public string MatchId { get; set; }
[JsonProperty("seat")] public int Seat { get; set; }
[JsonProperty("ticket")] public string Ticket { get; set; }
[JsonProperty("opponent")] public string Opponent { get; set; }
[JsonProperty("reason")] public string Reason { get; set; }
[JsonProperty("wsUrl")] public string WsUrl { get; set; }
}
public sealed class TicketRequest
{
[JsonProperty("matchId")] public string MatchId { get; set; } = string.Empty;
}
public sealed class TicketResponse
{
[JsonProperty("ticket")] public string Ticket { get; set; } = string.Empty;
[JsonProperty("matchId")] public string MatchId { get; set; } = string.Empty;
[JsonProperty("seat")] public int Seat { get; set; }
[JsonProperty("wsUrl")] public string WsUrl { get; set; } = string.Empty;
[JsonProperty("expiresAt")] public DateTimeOffset ExpiresAt { get; set; }
}
public sealed class Balances
{
[JsonProperty("gold")] public int Gold { get; set; }
[JsonProperty("dust")] public int Dust { get; set; }
[JsonProperty("tokens")] public int Tokens { get; set; }
}
public sealed class OnboardingResponse
{
[JsonProperty("balances")] public Balances Balances { get; set; } = new Balances();
[JsonProperty("deckId")] public string DeckId { get; set; } = string.Empty;
}
public sealed class OnboardingRequest
{
[JsonProperty("deckId")] public string DeckId { get; set; } = string.Empty;
}
public sealed class StoreResponse
{
[JsonProperty("balances")] public Balances Balances { get; set; } = new Balances();
[JsonProperty("boosterPriceGold")] public int BoosterPriceGold { get; set; }
[JsonProperty("trialDecks")] public List<StoreTrialDeckDto> TrialDecks { get; set; } = new List<StoreTrialDeckDto>();
}
public sealed class StoreTrialDeckDto
{
[JsonProperty("id")] public string Id { get; set; } = string.Empty;
[JsonProperty("name")] public string Name { get; set; } = string.Empty;
[JsonProperty("clan")] public string Clan { get; set; }
[JsonProperty("cardCount")] public int CardCount { get; set; }
[JsonProperty("owned")] public bool Owned { get; set; }
[JsonProperty("priceGold")] public int PriceGold { get; set; }
[JsonProperty("cards")] public List<TrialDeckCardDto> Cards { get; set; } = new List<TrialDeckCardDto>();
}
public sealed class TrialDeckCardDto
{
[JsonProperty("printingId")] public string PrintingId { get; set; } = string.Empty;
[JsonProperty("count")] public int Count { get; set; }
}
public sealed class CollectionResponse
{
[JsonProperty("items")] public List<CollectionItemDto> Items { get; set; } = new List<CollectionItemDto>();
[JsonProperty("balances")] public Balances Balances { get; set; } = new Balances();
}
public sealed class CollectionItemDto
{
[JsonProperty("printingId")] public string PrintingId { get; set; } = string.Empty;
[JsonProperty("nameId")] public string NameId { get; set; } = string.Empty;
[JsonProperty("nameEn")] public string NameEn { get; set; } = string.Empty;
[JsonProperty("rarity")] public string Rarity { get; set; } = string.Empty;
[JsonProperty("count")] public int Count { get; set; }
}
public sealed class DismantleRequest
{
[JsonProperty("printingId")] public string PrintingId { get; set; } = string.Empty;
[JsonProperty("count")] public int Count { get; set; }
[JsonProperty("idempotencyKey")] public string IdempotencyKey { get; set; } = string.Empty;
}
public sealed class DeckDto
{
[JsonProperty("id")] public Guid Id { get; set; }
[JsonProperty("name")] public string Name { get; set; } = string.Empty;
[JsonProperty("format")] public string Format { get; set; } = string.Empty;
[JsonProperty("cards")] public List<string> Cards { get; set; } = new List<string>();
[JsonProperty("createdAt")] public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("updatedAt")] public DateTimeOffset UpdatedAt { get; set; }
[JsonProperty("shareCode")] public string ShareCode { get; set; }
}
public sealed class DeckRequest
{
[JsonProperty("name")] public string Name { get; set; } = string.Empty;
[JsonProperty("cards")] public List<string> Cards { get; set; } = new List<string>();
}
public sealed class DeckValidationResponse
{
[JsonProperty("valid")] public bool Valid { get; set; }
[JsonProperty("violations")] public List<DeckViolationDto> Violations { get; set; } = new List<DeckViolationDto>();
}
public sealed class DeckViolationDto
{
[JsonProperty("code")] public string Code { get; set; } = string.Empty;
[JsonProperty("message")] public string Message { get; set; } = string.Empty;
}
public sealed class BoosterBuyRequest
{
[JsonProperty("payment")] public string Payment { get; set; } = "gold";
[JsonProperty("idempotencyKey")] public string IdempotencyKey { get; set; } = string.Empty;
}
public sealed class TrialDeckBuyRequest
{
[JsonProperty("deckId")] public string DeckId { get; set; } = string.Empty;
[JsonProperty("idempotencyKey")] public string IdempotencyKey { get; set; } = string.Empty;
}
public sealed class BoosterResultDto
{
[JsonProperty("cards")] public List<BoosterCardDto> Cards { get; set; } = new List<BoosterCardDto>();
[JsonProperty("balances")] public Balances Balances { get; set; } = new Balances();
}
public sealed class BoosterCardDto
{
[JsonProperty("printingId")] public string PrintingId { get; set; } = string.Empty;
[JsonProperty("nameId")] public string NameId { get; set; } = string.Empty;
[JsonProperty("rarity")] public string Rarity { get; set; } = string.Empty;
[JsonProperty("isNew")] public bool IsNew { get; set; }
}
public sealed class MatchHistoryResponseDto
{
[JsonProperty("items")] public List<MatchHistoryDto> Items { get; set; } = new List<MatchHistoryDto>();
}
public sealed class MatchHistoryDto
{
[JsonProperty("matchId")] public string MatchId { get; set; } = string.Empty;
[JsonProperty("mode")] public string Mode { get; set; } = string.Empty;
[JsonProperty("opponentName")] public string OpponentName { get; set; } = string.Empty;
[JsonProperty("result")] public string Result { get; set; } = string.Empty;
[JsonProperty("gold")] public int Gold { get; set; }
[JsonProperty("xp")] public int Xp { get; set; }
[JsonProperty("mmrBefore")] public int MmrBefore { get; set; }
[JsonProperty("mmrAfter")] public int MmrAfter { get; set; }
[JsonProperty("finishReason")] public string FinishReason { get; set; } = string.Empty;
[JsonProperty("playedAt")] public DateTimeOffset PlayedAt { get; set; }
[JsonProperty("replayAvailable")] public bool ReplayAvailable { get; set; }
}
public sealed class ReplayResponseDto
{
[JsonProperty("matchId")] public string MatchId { get; set; } = string.Empty;
[JsonProperty("mode")] public string Mode { get; set; } = string.Empty;
[JsonProperty("player0")] public string Player0 { get; set; } = string.Empty;
[JsonProperty("player1")] public string Player1 { get; set; } = string.Empty;
[JsonProperty("viewerSeat")] public int ViewerSeat { get; set; }
[JsonProperty("winner")] public int Winner { get; set; }
[JsonProperty("finishReason")] public string FinishReason { get; set; } = string.Empty;
[JsonProperty("eventHash")] public string EventHash { get; set; } = string.Empty;
[JsonProperty("events")] public List<ReplayEventDto> Events { get; set; } = new List<ReplayEventDto>();
[JsonProperty("frames")] public List<ReplayFrameDto> Frames { get; set; } = new List<ReplayFrameDto>();
}
public sealed class ReplayEventDto
{
[JsonProperty("seq")] public long Seq { get; set; }
[JsonProperty("kind")] public string Kind { get; set; } = string.Empty;
[JsonProperty("event")] public JToken Event { get; set; }
}
public sealed class ReplayFrameDto
{
[JsonProperty("eventSeq")] public long EventSeq { get; set; }
[JsonProperty("view")] public MatchView View { get; set; }
}
public sealed class CardCatalogItemDto
{
[JsonProperty("printingId")] public string PrintingId { get; set; } = string.Empty;
[JsonProperty("nameId")] public string NameId { get; set; } = string.Empty;
[JsonProperty("nameEn")] public string NameEn { get; set; } = string.Empty;
[JsonProperty("rarity")] public string Rarity { get; set; } = string.Empty;
[JsonProperty("grade")] public int Grade { get; set; }
[JsonProperty("trigger")] public string Trigger { get; set; } = "None";
[JsonProperty("clan")] public string Clan { get; set; } = string.Empty;
[JsonProperty("isSentinel")] public bool IsSentinel { get; set; }
[JsonProperty("isParallel")] public bool IsParallel { get; set; }
[JsonProperty("basePrintingId")] public string BasePrintingId { get; set; }
}
}