import { v4 as uuid } from 'uuid' ; import { BattleStatus , BattleType , IBattle } from './' ; import { Tank } from '../../tanks' ; const battleSample = { name : 'Battle Royale' , description : 'The battle between many tightens.' , opponents : [ { id : "1" } , { id : "2" } , { id : "3" } ] , status : BattleStatus . CREATED , } ; export class Battle implements IBattle { public id ? : string ; public name ? : string ; public description ? : string ; public status ? : BattleStatus = BattleStatus . CREATED ; public type ? : BattleType = BattleType . ONE_ON_ONE ; public opponents ? : Tank [ ] = [ ] ; description param { BattleType } type param { Tank [ ] } tanks memberof public constructor ( battle = battleSample ) { this . id = ( battle . id ) ? battle . id : uuid ( ) ; this . name = battle . name ; this . description = battle . description ; this . status = ( battle . status ) ? battle . status : BattleStatus . CREATED ; this . type = ( battle . type ) ? battle . type : BattleType . ONE_ON_ONE ; this . opponents = battle . opponents ; } }