001/*
002 * This file is part of the Keycloak Moodle authenticator
003 * Copyright (C) 2024 Michael N. Lipp
004 *
005 * This program is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU Lesser General Public License as published
007 * by the Free Software Foundation; either version 3 of the License, or 
008 * (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful, but 
011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
013 * License for more details.
014 *
015 * You should have received a copy of the GNU Lesser General Public License along 
016 * with this program; if not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jdrupes.keycloak.moodleauth.moodle.model;
020
021import java.time.Instant;
022
023/**
024 * Models the participant specific info of a user.
025 */
026@SuppressWarnings("PMD.DataClass")
027public class MoodleParticipantInfo extends MoodleErrorValues {
028
029    private long id;
030    private long assignmentId;
031    private boolean submitted;
032    private boolean requiregrading;
033    private long duedate;
034    private long cutoffdate;
035
036    /**
037     * @return the id
038     */
039    public long getId() {
040        return id;
041    }
042
043    /**
044     * @param id the id to set
045     */
046    public void setId(long id) {
047        this.id = id;
048    }
049
050    /**
051     * @return the assignmentId
052     */
053    public long getAssignmentId() {
054        return assignmentId;
055    }
056
057    /**
058     * @param assignmentId the assignmentId to set
059     */
060    public void setAssignmentId(long assignmentId) {
061        this.assignmentId = assignmentId;
062    }
063
064    /**
065     * @return the submitted
066     */
067    public boolean isSubmitted() {
068        return submitted;
069    }
070
071    /**
072     * @param submitted the submitted to set
073     */
074    public void setSubmitted(boolean submitted) {
075        this.submitted = submitted;
076    }
077
078    /**
079     * @return the requiregrading
080     */
081    public boolean isRequiregrading() {
082        return requiregrading;
083    }
084
085    /**
086     * @param requiregrading the requiregrading to set
087     */
088    public void setRequiregrading(boolean requiregrading) {
089        this.requiregrading = requiregrading;
090    }
091
092    /**
093     * @return the duedate
094     */
095    public long getDuedate() {
096        return duedate;
097    }
098
099    /**
100     * @param duedate the duedate to set
101     */
102    public void setDuedate(long duedate) {
103        this.duedate = duedate;
104    }
105
106    /**
107     * @return the cutoffdate
108     */
109    public long getCutoffdate() {
110        return cutoffdate;
111    }
112
113    /**
114     * @param cutoffdate the cutoffdate to set
115     */
116    public void setCutoffdate(long cutoffdate) {
117        this.cutoffdate = cutoffdate;
118    }
119
120    /**
121     * Due date.
122     *
123     * @return the instant
124     */
125    public Instant dueDate() {
126        return Instant.ofEpochSecond(duedate);
127    }
128
129    /**
130     * Cut off date.
131     *
132     * @return the instant
133     */
134    public Instant cutOffDate() {
135        return Instant.ofEpochSecond(cutoffdate);
136    }
137
138    @Override
139    public String toString() {
140        return "MoodleParticipantInfo [id=" + id + ", assignmentId="
141            + assignmentId + ", submitted=" + submitted + ", requiregrading="
142            + requiregrading + ", duedate=" + dueDate() + ", cutoffdate="
143            + cutOffDate() + "]";
144    }
145}