/*
 * Copyright 2016 Benoît Prioux
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.bdxjug.api.domain.meetings;

import lombok.Data;

import java.time.LocalDate;

@Data
public class Meeting implements Comparable<Meeting> {

    private final MeetingID id;
    private final LocalDate date;
    private final SpeakerID speakerID;
    private final LocationID locationID;
    private final String title;

    private String summary;
    private String description;
    private RegistrationID registrationID;

    public boolean isPast() {
        return date.isBefore(LocalDate.now());
    }

    public boolean isUpcoming() {
        return date.isAfter(LocalDate.now());
    }

    public boolean isPublished() {
        return registrationID != null;
    }

    @Override
    public int compareTo(Meeting o) {
        return o.date.compareTo(this.date);
    }
}

@@ -1,10 +1,11 @@
 /*
+%0D
 %0A * Copy
@@ -28,19 +28,21 @@
 t Prioux
+%0D
 %0A *
+%0D
 %0A * Lice
@@ -100,16 +100,17 @@
 cense%22);
+%0D
 %0A * you 
@@ -169,16 +169,17 @@
 License.
+%0D
 %0A * You 
@@ -213,19 +213,21 @@
 cense at
+%0D
 %0A *
+%0D
 %0A *    h
@@ -267,19 +267,21 @@
 ENSE-2.0
+%0D
 %0A *
+%0D
 %0A * Unle
@@ -343,16 +343,17 @@
 software
+%0D
 %0A * dist
@@ -413,16 +413,17 @@
 %22 BASIS,
+%0D
 %0A * WITH
@@ -490,16 +490,17 @@
 implied.
+%0D
 %0A * See 
@@ -562,16 +562,17 @@
 ions and
+%0D
 %0A * limi
@@ -601,12 +601,14 @@
 nse.
+%0D
 %0A */
+%0D
 %0Apac
@@ -643,17 +643,19 @@
 eetings;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -666,17 +666,19 @@
 ok.Data;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -701,15 +701,18 @@
 ate;
-%0A
+%0D%0A%0D
 %0A@Data
+%0D
 %0Apub
@@ -761,17 +761,19 @@
 eting%3E %7B
-%0A
+%0D%0A%0D
 %0A    pri
@@ -796,16 +796,17 @@
 ngID id;
+%0D
 %0A    pri
@@ -831,16 +831,17 @@
 te date;
+%0D
 %0A    pri
@@ -871,16 +871,17 @@
 eakerID;
+%0D
 %0A    pri
@@ -913,16 +913,17 @@
 ationID;
+%0D
 %0A    pri
@@ -946,17 +946,19 @@
 g title;
-%0A
+%0D%0A%0D
 %0A    pri
@@ -977,16 +977,17 @@
 summary;
+%0D
 %0A    pri
@@ -1010,16 +1010,17 @@
 ription;
+%0D
 %0A    pri
@@ -1054,17 +1054,19 @@
 ationID;
-%0A
+%0D%0A%0D
 %0A    pub
@@ -1083,24 +1083,25 @@
 n isPast() %7B
+%0D
 %0A        ret
@@ -1127,39 +1127,42 @@
 ocalDate.now());
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    public bool
@@ -1175,24 +1175,25 @@
 Upcoming() %7B
+%0D
 %0A        ret
@@ -1224,25 +1224,42 @@
 te.now()
+.minusDays(1l)
 );
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    pub
@@ -1285,16 +1285,17 @@
 shed() %7B
+%0D
 %0A       
@@ -1325,23 +1325,26 @@
 != null;
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    @Ov
@@ -1349,16 +1349,17 @@
 Override
+%0D
 %0A    pub
@@ -1388,16 +1388,17 @@
 ing o) %7B
+%0D
 %0A       
@@ -1437,13 +1437,16 @@
 te);
+%0D
 %0A    %7D
+%0D
 %0A%7D
+%0D
 %0A

remove one day to upcoming.