From f1c40240e40d43760038de8d59cc86671b076c9e Mon Sep 17 00:00:00 2001
From: Thomas Lenz <Thomas.Lenz@mni.thm.de>
Date: Wed, 14 Mar 2018 12:53:16 +0100
Subject: [PATCH] Add text-content data model and implemented inheritance for
 choice-content Add constructors for all contents

---
 src/app/answer-option.ts  |  4 ++++
 src/app/choice-content.ts | 17 +++++++++++++++--
 src/app/text-content.ts   | 15 +++++++++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 src/app/text-content.ts

diff --git a/src/app/answer-option.ts b/src/app/answer-option.ts
index ce6c6e0ab..b8a1fefbf 100644
--- a/src/app/answer-option.ts
+++ b/src/app/answer-option.ts
@@ -1,4 +1,8 @@
 export class AnswerOption {
+  constructor(label: string, points: string) {
+   this.label = label;
+   this.points = points;
+  }
   label: string;
   points: string;
 }
diff --git a/src/app/choice-content.ts b/src/app/choice-content.ts
index 74fc7a339..27a4580fe 100644
--- a/src/app/choice-content.ts
+++ b/src/app/choice-content.ts
@@ -1,7 +1,20 @@
 import { AnswerOption } from './answer-option';
+import { Content, Format } from './content';
 
-export class ChoiceContent {
+export class ChoiceContent extends Content {
+  constructor(roomId: string, subject: string, body: string, options: AnswerOption[], correctOptionIndexes: number[], multiple: boolean) {
+    super();
+    this.revision = '1';
+    this.roomId = roomId;
+    this.subject = subject;
+    this.body = body;
+    this.round = 1;
+    this.format = Format.CHOICE;
+    this.options = options;
+    this.correctOptionIndexes = correctOptionIndexes;
+    this.multiple = multiple;
+  }
   options: AnswerOption[];
-  correctOtionIndexes: number[];
+  correctOptionIndexes: number[];
   multiple: boolean;
 }
diff --git a/src/app/text-content.ts b/src/app/text-content.ts
new file mode 100644
index 000000000..363d19ea6
--- /dev/null
+++ b/src/app/text-content.ts
@@ -0,0 +1,15 @@
+import { Content, Format } from './content';
+
+export class TextContent extends Content {
+
+  constructor(roomId: string, subject: string, body: string) {
+    super();
+    this.revision = '1';
+    this.roomId = roomId;
+    this.subject = subject;
+    this.body = body;
+    this.round = 1;
+    this.format = Format.TEXT;
+    this.formatAttributes.clear(); // API: formatAttributes = Map.empty();
+  }
+}
-- 
GitLab