wip
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
/**
|
||||
* Domain Value Object: GameConstraints
|
||||
*
|
||||
*
|
||||
* Represents game-specific constraints for leagues.
|
||||
* Different sim racing games have different maximum grid sizes.
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@gridpilot/shared/domain';
|
||||
|
||||
export interface GameConstraintsData {
|
||||
readonly maxDrivers: number;
|
||||
readonly maxTeams: number;
|
||||
@@ -14,6 +16,11 @@ export interface GameConstraintsData {
|
||||
readonly supportsMultiClass: boolean;
|
||||
}
|
||||
|
||||
export interface GameConstraintsProps {
|
||||
gameId: string;
|
||||
constraints: GameConstraintsData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Game-specific constraints for popular sim racing games
|
||||
*/
|
||||
@@ -69,7 +76,7 @@ const GAME_CONSTRAINTS: Record<string, GameConstraintsData> = {
|
||||
},
|
||||
};
|
||||
|
||||
export class GameConstraints {
|
||||
export class GameConstraints implements IValueObject<GameConstraintsProps> {
|
||||
readonly gameId: string;
|
||||
readonly constraints: GameConstraintsData;
|
||||
|
||||
@@ -78,6 +85,17 @@ export class GameConstraints {
|
||||
this.constraints = constraints;
|
||||
}
|
||||
|
||||
get props(): GameConstraintsProps {
|
||||
return {
|
||||
gameId: this.gameId,
|
||||
constraints: this.constraints,
|
||||
};
|
||||
}
|
||||
|
||||
equals(other: IValueObject<GameConstraintsProps>): boolean {
|
||||
return this.props.gameId === other.props.gameId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get constraints for a specific game
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user