157 lines
2.8 KiB
Go
157 lines
2.8 KiB
Go
package domain
|
|
|
|
type OpponentsDefeated struct {
|
|
rankAtt int
|
|
scoreAtt int
|
|
rankDef int
|
|
scoreDef int
|
|
rankSup int
|
|
scoreSup int
|
|
rankTotal int
|
|
scoreTotal int
|
|
}
|
|
|
|
const opponentsDefeatedModelName = "OpponentsDefeated"
|
|
|
|
func NewOpponentsDefeated(
|
|
rankAtt int,
|
|
scoreAtt int,
|
|
rankDef int,
|
|
scoreDef int,
|
|
rankSup int,
|
|
scoreSup int,
|
|
rankTotal int,
|
|
scoreTotal int,
|
|
) (OpponentsDefeated, error) {
|
|
if rankAtt < 0 {
|
|
return OpponentsDefeated{}, ValidationError{
|
|
Model: opponentsDefeatedModelName,
|
|
Field: "rankAtt",
|
|
Err: MinGreaterEqualError{
|
|
Min: 0,
|
|
Current: rankAtt,
|
|
},
|
|
}
|
|
}
|
|
|
|
if scoreAtt < 0 {
|
|
return OpponentsDefeated{}, ValidationError{
|
|
Model: opponentsDefeatedModelName,
|
|
Field: "scoreAtt",
|
|
Err: MinGreaterEqualError{
|
|
Min: 0,
|
|
Current: scoreAtt,
|
|
},
|
|
}
|
|
}
|
|
|
|
if rankDef < 0 {
|
|
return OpponentsDefeated{}, ValidationError{
|
|
Model: opponentsDefeatedModelName,
|
|
Field: "rankDef",
|
|
Err: MinGreaterEqualError{
|
|
Min: 0,
|
|
Current: rankDef,
|
|
},
|
|
}
|
|
}
|
|
|
|
if scoreDef < 0 {
|
|
return OpponentsDefeated{}, ValidationError{
|
|
Model: opponentsDefeatedModelName,
|
|
Field: "scoreDef",
|
|
Err: MinGreaterEqualError{
|
|
Min: 0,
|
|
Current: scoreDef,
|
|
},
|
|
}
|
|
}
|
|
|
|
if rankSup < 0 {
|
|
return OpponentsDefeated{}, ValidationError{
|
|
Model: opponentsDefeatedModelName,
|
|
Field: "rankSup",
|
|
Err: MinGreaterEqualError{
|
|
Min: 0,
|
|
Current: rankSup,
|
|
},
|
|
}
|
|
}
|
|
|
|
if scoreSup < 0 {
|
|
return OpponentsDefeated{}, ValidationError{
|
|
Model: opponentsDefeatedModelName,
|
|
Field: "scoreSup",
|
|
Err: MinGreaterEqualError{
|
|
Min: 0,
|
|
Current: scoreSup,
|
|
},
|
|
}
|
|
}
|
|
|
|
if rankTotal < 0 {
|
|
return OpponentsDefeated{}, ValidationError{
|
|
Model: opponentsDefeatedModelName,
|
|
Field: "rankTotal",
|
|
Err: MinGreaterEqualError{
|
|
Min: 0,
|
|
Current: rankTotal,
|
|
},
|
|
}
|
|
}
|
|
|
|
if scoreTotal < 0 {
|
|
return OpponentsDefeated{}, ValidationError{
|
|
Model: opponentsDefeatedModelName,
|
|
Field: "scoreTotal",
|
|
Err: MinGreaterEqualError{
|
|
Min: 0,
|
|
Current: scoreTotal,
|
|
},
|
|
}
|
|
}
|
|
|
|
return OpponentsDefeated{
|
|
rankAtt: rankAtt,
|
|
scoreAtt: scoreAtt,
|
|
rankDef: rankDef,
|
|
scoreDef: scoreDef,
|
|
rankSup: rankSup,
|
|
scoreSup: scoreSup,
|
|
rankTotal: rankTotal,
|
|
scoreTotal: scoreTotal,
|
|
}, nil
|
|
}
|
|
|
|
func (o OpponentsDefeated) RankAtt() int {
|
|
return o.rankAtt
|
|
}
|
|
|
|
func (o OpponentsDefeated) ScoreAtt() int {
|
|
return o.scoreAtt
|
|
}
|
|
|
|
func (o OpponentsDefeated) RankDef() int {
|
|
return o.rankDef
|
|
}
|
|
|
|
func (o OpponentsDefeated) ScoreDef() int {
|
|
return o.scoreDef
|
|
}
|
|
|
|
func (o OpponentsDefeated) RankSup() int {
|
|
return o.rankSup
|
|
}
|
|
|
|
func (o OpponentsDefeated) ScoreSup() int {
|
|
return o.scoreSup
|
|
}
|
|
|
|
func (o OpponentsDefeated) RankTotal() int {
|
|
return o.rankTotal
|
|
}
|
|
|
|
func (o OpponentsDefeated) ScoreTotal() int {
|
|
return o.scoreTotal
|
|
}
|