diff --git a/src/factory/BoardViewModelFactory.ts b/src/factory/BoardViewModelFactory.ts new file mode 100644 index 0000000..cd8e74f --- /dev/null +++ b/src/factory/BoardViewModelFactory.ts @@ -0,0 +1,11 @@ +import BoardViewModel from "../viewmodel/BoardViewModel"; +import PitViewModel from "../viewmodel/PitViewModel"; + +export default class BoardViewModelFactory { + public static create( + id: string, + pitViewModels: PitViewModel[] + ): BoardViewModel { + return new BoardViewModel(id, pitViewModels); + } +} diff --git a/src/factory/PitViewModelFactory.ts b/src/factory/PitViewModelFactory.ts new file mode 100644 index 0000000..00d33b2 --- /dev/null +++ b/src/factory/PitViewModelFactory.ts @@ -0,0 +1,13 @@ +import PitViewModel from "../viewmodel/PitViewModel"; + +export class PitViewModelFactory { + public static create(params: { + id: string; + stoneCount: number; + stoneColor: string; + pitColor: string; + }): PitViewModel { + const { id, stoneCount, stoneColor, pitColor } = params; + return new PitViewModel(id, stoneCount, stoneColor, pitColor); + } +} diff --git a/src/viewmodel/BoardViewModel.ts b/src/viewmodel/BoardViewModel.ts new file mode 100644 index 0000000..02b59c7 --- /dev/null +++ b/src/viewmodel/BoardViewModel.ts @@ -0,0 +1,10 @@ +import PitViewModel from "./PitViewModel"; + +export default class BoardViewModel { + id: string; + pits: PitViewModel[]; + constructor(id: string, pits: PitViewModel[]) { + this.id = id; + this.pits = pits; + } +} diff --git a/src/viewmodel/PitViewModel.ts b/src/viewmodel/PitViewModel.ts new file mode 100644 index 0000000..090469e --- /dev/null +++ b/src/viewmodel/PitViewModel.ts @@ -0,0 +1,18 @@ +export default class PitViewModel { + id: string; + stoneCount: number; + stoneColor: string; + pitColor: string; + + constructor( + id: string, + stoneCount: number, + stoneColor: string, + pitColor: string + ) { + this.id = id; + this.stoneCount = stoneCount; + this.stoneColor = stoneColor; + this.pitColor = pitColor; + } +}