Files
galaxy-game/internal/model/rest/command.go
T
2026-01-07 13:52:20 +02:00

27 lines
1013 B
Go

package rest
/*
Full list of requirements must be updated when adding new command:
required_without_all=Vote DeclarePeace DeclareWar
| excluded_with=Vote DeclarePeace DeclareWar
*/
type Command struct {
Race string `json:"race" binding:"required,notblank"`
Vote *CommandVote `json:"vote" binding:"required_without_all=DeclarePeace DeclareWar,excluded_with=DeclarePeace DeclareWar"`
DeclarePeace *CommandDeclarePeace `json:"declarePeace" binding:"required_without_all=Vote DeclareWar,excluded_with=Vote DeclareWar"`
DeclareWar *CommandDeclareWar `json:"declareWar" binding:"required_without_all=Vote DeclarePeace,excluded_with=Vote DeclarePeace"`
}
type CommandVote struct {
Recipient string `json:"recipient" binding:"required,notblank"`
}
type CommandDeclarePeace struct {
Opponent string `json:"recipient" binding:"required,notblank"`
}
type CommandDeclareWar struct {
Opponent string `json:"recipient" binding:"required,notblank"`
}