82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
namespace LocationsApi.Models;
|
|
|
|
public class TrainUnitRequest
|
|
{
|
|
public string UnitType { get; set; } = "Scout";
|
|
public int? Q { get; set; }
|
|
public int? R { get; set; }
|
|
}
|
|
|
|
public class MoveUnitSquadRequest
|
|
{
|
|
public string UnitType { get; set; } = "Archer";
|
|
public int FromQ { get; set; }
|
|
public int FromR { get; set; }
|
|
public int ToQ { get; set; }
|
|
public int ToR { get; set; }
|
|
}
|
|
|
|
public class UnitTrainingResponse
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string Username { get; set; } = "";
|
|
public string UnitType { get; set; } = "";
|
|
public int GoldCost { get; set; }
|
|
public int WoodCost { get; set; }
|
|
public int OreCost { get; set; }
|
|
public int? OriginQ { get; set; }
|
|
public int? OriginR { get; set; }
|
|
public string Status { get; set; } = "";
|
|
public DateTime StartedAtUtc { get; set; }
|
|
public DateTime CompletesAtUtc { get; set; }
|
|
public DateTime? CompletedAtUtc { get; set; }
|
|
|
|
public static UnitTrainingResponse FromTraining(UnitTraining training) => new()
|
|
{
|
|
Id = training.Id,
|
|
Username = training.Username,
|
|
UnitType = training.UnitType,
|
|
GoldCost = training.GoldCost,
|
|
WoodCost = training.WoodCost,
|
|
OreCost = training.OreCost,
|
|
OriginQ = training.OriginQ,
|
|
OriginR = training.OriginR,
|
|
Status = training.Status,
|
|
StartedAtUtc = training.StartedAtUtc,
|
|
CompletesAtUtc = training.CompletesAtUtc,
|
|
CompletedAtUtc = training.CompletedAtUtc
|
|
};
|
|
}
|
|
|
|
public class UnitInstanceResponse
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string Username { get; set; } = "";
|
|
public string UnitType { get; set; } = "";
|
|
public int Q { get; set; }
|
|
public int R { get; set; }
|
|
public string Status { get; set; } = "";
|
|
public DateTime CreatedAtUtc { get; set; }
|
|
public DateTime UpdatedAtUtc { get; set; }
|
|
|
|
public static UnitInstanceResponse FromUnit(UnitInstance unit) => new()
|
|
{
|
|
Id = unit.Id,
|
|
Username = unit.Username,
|
|
UnitType = unit.UnitType,
|
|
Q = unit.Q,
|
|
R = unit.R,
|
|
Status = unit.Status,
|
|
CreatedAtUtc = unit.CreatedAtUtc,
|
|
UpdatedAtUtc = unit.UpdatedAtUtc
|
|
};
|
|
}
|
|
|
|
public class PlayerUnitsResponse
|
|
{
|
|
public int CompletedScouts { get; set; }
|
|
public int CompletedArchers { get; set; }
|
|
public List<UnitTrainingResponse> Training { get; set; } = [];
|
|
public List<UnitInstanceResponse> Units { get; set; } = [];
|
|
}
|