2020-10-13 17:07:04 +02:00
|
|
|
package com.plannaplan.responses.models;
|
|
|
|
|
2020-12-29 16:36:12 +01:00
|
|
|
import java.util.HashMap;
|
|
|
|
|
2020-10-28 13:44:13 +01:00
|
|
|
import com.plannaplan.entities.Course;
|
|
|
|
import com.plannaplan.entities.Groups;
|
|
|
|
import com.plannaplan.types.GroupType;
|
2020-10-13 17:07:04 +02:00
|
|
|
|
2020-11-08 16:55:56 +01:00
|
|
|
import io.swagger.annotations.ApiModel;
|
|
|
|
|
2020-11-08 17:20:00 +01:00
|
|
|
@ApiModel(description = "Response shows information about given assigment to course.", value = "AssignmentResponse")
|
|
|
|
public class AssignmentResponse {
|
2020-10-28 13:44:13 +01:00
|
|
|
private Long id;
|
|
|
|
private String name;
|
2020-11-08 17:20:00 +01:00
|
|
|
private GroupWithCapacityResponse classes;
|
|
|
|
private GroupWithCapacityResponse lecture;
|
2020-10-13 17:07:04 +02:00
|
|
|
|
2020-11-08 17:20:00 +01:00
|
|
|
public AssignmentResponse(Course course, Groups lecture, Groups classes) {
|
2020-10-28 13:44:13 +01:00
|
|
|
this.id = course.getId();
|
|
|
|
this.name = course.getName();
|
2020-11-08 17:20:00 +01:00
|
|
|
this.lecture = lecture == null ? null : new GroupWithCapacityResponse(lecture);
|
|
|
|
this.classes = classes == null ? null : new GroupWithCapacityResponse(classes);
|
2020-10-28 13:44:13 +01:00
|
|
|
}
|
|
|
|
|
2020-12-29 16:36:12 +01:00
|
|
|
public AssignmentResponse(Course course, Groups lecture, Groups classes, HashMap<Long, Integer> ammounts) {
|
|
|
|
this.id = course.getId();
|
|
|
|
this.name = course.getName();
|
|
|
|
this.lecture = lecture == null ? null : new GroupWithCapacityResponse(lecture, ammounts.get(lecture.getId()));
|
|
|
|
this.classes = classes == null ? null : new GroupWithCapacityResponse(classes, ammounts.get(classes.getId()));
|
|
|
|
}
|
|
|
|
|
2020-11-08 17:20:00 +01:00
|
|
|
public AssignmentResponse(Course course, Groups group) {
|
2020-10-28 13:44:13 +01:00
|
|
|
this(course, group.getType() == GroupType.LECTURE ? group : null,
|
|
|
|
group.getType() == GroupType.CLASS ? group : null);
|
|
|
|
}
|
|
|
|
|
2020-12-29 16:36:12 +01:00
|
|
|
public AssignmentResponse(Course course, Groups group, HashMap<Long, Integer> ammounts) {
|
|
|
|
this(course, group.getType() == GroupType.LECTURE ? group : null,
|
|
|
|
group.getType() == GroupType.CLASS ? group : null, ammounts);
|
|
|
|
}
|
|
|
|
|
2020-11-08 17:20:00 +01:00
|
|
|
public GroupWithCapacityResponse getLecture() {
|
2020-10-28 13:44:13 +01:00
|
|
|
return this.lecture;
|
|
|
|
}
|
|
|
|
|
2020-11-08 17:20:00 +01:00
|
|
|
public GroupWithCapacityResponse getClasses() {
|
2020-10-28 13:44:13 +01:00
|
|
|
return this.classes;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return this.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Long getId() {
|
|
|
|
return this.id;
|
2020-10-13 17:07:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|