tracking units

This commit is contained in:
hz
2026-05-19 05:20:28 -05:00
parent e78eb24543
commit b0b270f4d8
8 changed files with 258 additions and 22 deletions
@@ -3,6 +3,8 @@ namespace LocationsApi.Models;
public class TrainUnitRequest
{
public string UnitType { get; set; } = "Scout";
public int? Q { get; set; }
public int? R { get; set; }
}
public class UnitTrainingResponse
@@ -13,6 +15,8 @@ public class UnitTrainingResponse
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; }
@@ -26,6 +30,8 @@ public class UnitTrainingResponse
GoldCost = training.GoldCost,
WoodCost = training.WoodCost,
OreCost = training.OreCost,
OriginQ = training.OriginQ,
OriginR = training.OriginR,
Status = training.Status,
StartedAtUtc = training.StartedAtUtc,
CompletesAtUtc = training.CompletesAtUtc,
@@ -33,9 +39,34 @@ public class UnitTrainingResponse
};
}
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; } = [];
}