@startuml
title Class diagram for Messaging extension

package Messages {
	class Message{
		content: String
		response: Message
		respond(User, String)
	}
	class Discussion{
		name: String
		users: ArrayList<User>
		invite(User)
		sendMessage(User, String)
	}
	Discussion *-- Message
}

package Forums {
	class Forum{
		name: String
		Owner: Teacher
		Registered: ArrayList<User>
		{static} createForum(Course): Forum
		createTopic(String): Topic
		createPoll(String, PollType, ArrayList<Option>): Poll
	}
	class Topic{
		subject: String
		author: Teacher 
		content: String
		answer(User, String): Answer
		lock(Boolean)
	}
	class Answer{
		author: User
		content: String
		anonymous: Boolean 
		remove()
	}
	class Poll{
		options: ArrayList<Option>
		type: PollType
		answer(User, Option): Vote
		addOption(Option)
	}
	class Option{
		name: String
	}
	class Vote{
		voter: User
	}
	enum PollType {
		ALLOW_NEW_OPTIONS
		ALLOW_MULTIPLE_CHOICE
	}
	note "Change the behaviour of poll" as N

	Forum *-l- Topic
	Topic *-l- Answer

	Topic <|-d- Poll
	Poll *-l- Option
	Option "1..*" -d-x Vote
	Poll *-- Vote

	Poll -- PollType
	PollType .r. N

}

package Appointments{
	class Appointment{
		date: Date
		teacher: Teacher
		student: Student
		{static} Appointment(Student, Teacher, Date)
		accept()
		refuse()
		propose(Date)
		export(): File
	}
}

Appointments -[hidden]d- Messages
@enduml