package com.plannaplan.responses.models; import com.plannaplan.entities.Assignment; import com.plannaplan.entities.Groups; import com.plannaplan.types.GroupType; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @ApiModel(description = "Response shows information about given group.", value = "GroupDefaultResponse") public class GroupDefaultResponse { @ApiModelProperty(value = "ID created by database.") private Long id; @ApiModelProperty(value = "Value shows what day when the course is. Example 0 is Monday.") private int day; @ApiModelProperty(value = "Value shows time when the course takes.") private String time; @ApiModelProperty(value = "Value shows degree, name and surname.") private String lecturer; @ApiModelProperty(value = "Value shows room where the class takes.") private String room; @ApiModelProperty(value = "Value shows kind of group. The types are LECTURE or CLASS.") private GroupType type; @ApiModelProperty(value = "Value shows how many places is already taken by other students.") private int takenPlaces; public GroupDefaultResponse(Groups group) { this.id = group.getId() != null ? group.getId() : null; this.day = group.getDay() != null ? group.getDay().label : -1; this.time = group.getTimeString() != null ? group.getTimeString() : ""; this.lecturer = group.getLecturer() != null ? group.getLecturer().toString() : ""; this.room = group.getRoom() != null ? group.getRoom() : ""; this.type = group.getType() != null ? group.getType() : null; } public GroupDefaultResponse(Groups group, int takenPlaces) { this(group); this.takenPlaces = takenPlaces; } public GroupDefaultResponse(Assignment assignment) { this(assignment.getGroup()); } public GroupType getType() { return type; } public String getRoom() { return room; } public String getLecturer() { return lecturer; } public String getTime() { return time; } public int getDay() { return day; } public Long getId() { return id; } public int getTakenPlaces() { return this.takenPlaces; } }