001/*
002 *  Copyright 2014 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.workspaces.calendars;
017
018import java.time.ZonedDateTime;
019import java.util.List;
020import java.util.Map;
021
022import org.ametys.plugins.workspaces.calendars.events.CalendarEvent;
023import org.ametys.plugins.workspaces.calendars.events.CalendarEventOccurrence;
024import org.ametys.plugins.workspaces.project.objects.Project;
025
026/**
027 * Calendar Interface
028 */
029public interface Calendar
030{
031    /**
032     * Enumeration of calendar visiblity
033     */
034    public enum CalendarVisibility
035    {
036        /** Public */
037        PUBLIC,
038        /** Private */
039        PRIVATE;
040    }
041    
042    /**
043     * Get the id of the calendar
044     * @return the id
045     */
046    public String getId();
047    
048    /**
049     * Get the name of the calendar
050     * @return the name
051     */
052    public String getName();
053    
054    /**
055     * Get the description of the calendar
056     * @return the description
057     */
058    public String getDescription();
059    
060    /**
061     * Get the project
062     * @return the project
063     */
064    public Project getProject();
065    
066    /**
067     * Get the color of the calendar
068     * @return the color of the calendar
069     */
070    public String getColor();
071    
072    /**
073     * Get the calendar visibility
074     * @return the calendar visibility
075     */
076    public CalendarVisibility getVisibility();
077    
078    /**
079     * Get the template description of the calendar
080     * @return the template description of the calendar
081     */
082    public String getTemplateDescription();
083    
084    /**
085     * Get the child calendars
086     * @return the child calendars
087     */
088    public List<Calendar> getChildCalendars();
089    
090    /**
091     * Get all events of the calendar
092     * @return the list of events
093     */
094    public List<CalendarEvent> getAllEvents();
095    
096    /**
097     * Get the events and its occurrences of the calendar between two dates
098     * @param startDate Begin date
099     * @param endDate End date
100     * @return the map of events and its occurrences
101     */
102    public Map<CalendarEvent, List<CalendarEventOccurrence>> getEvents(ZonedDateTime startDate, ZonedDateTime endDate);
103    
104    /**
105     * Get the token used by the ICS public URL
106     * @return The token, or null if no token exists for the calendar
107     */
108    public String getIcsUrlToken();
109}