// Path: src/main/java/com/jeanchampemont/wtfdyum/dto/Event.java
// public class Event {
// 
//     public Event() {
//         // left deliberately empty
//     }
// 
//     public Event(final EventType type, final String additionalData) {
//         this.type = type;
//         this.additionalData = additionalData;
//     }
// 
//     private EventType type;
// 
//     private String additionalData;
// 
//     private LocalDateTime creationDateTime;
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         final Event other = (Event) obj;
//         if (additionalData == null) {
//             if (other.additionalData != null) {
//                 return false;
//             }
//         } else if (!additionalData.equals(other.additionalData)) {
//             return false;
//         }
//         if (creationDateTime == null) {
//             if (other.creationDateTime != null) {
//                 return false;
//             }
//         } else if (!creationDateTime.equals(other.creationDateTime)) {
//             return false;
//         }
//         if (type != other.type) {
//             return false;
//         }
//         return true;
//     }
// 
//     public String getAdditionalData() {
//         return additionalData;
//     }
// 
//     public LocalDateTime getCreationDateTime() {
//         return creationDateTime;
//     }
// 
//     @JsonIgnore
//     public String getMessage() {
//         return String.format(type.getMessage(), additionalData);
//     }
// 
//     public EventType getType() {
//         return type;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(this.type, this.creationDateTime, this.additionalData);
//     }
// 
//     public void setAdditionalData(final String additionalData) {
//         this.additionalData = additionalData;
//     }
// 
//     public void setCreationDateTime(final LocalDateTime creationDateTime) {
//         this.creationDateTime = creationDateTime;
//     }
// 
//     public void setType(final EventType type) {
//         this.type = type;
//     }
// }
// 
// Path: src/main/java/com/jeanchampemont/wtfdyum/dto/Feature.java
// public enum Feature {
// 
//     NOTIFY_UNFOLLOW("Send me a direct message when someone stops following me", "unfollow notifications"),
// 
//     TWEET_UNFOLLOW("Send a public tweet with @mention when someone stops following me", "unfollow tweet");
// 
//     private Feature(final String message, final String shortName) {
//         this.message = message;
//         this.shortName = shortName;
//     }
// 
//     private String message;
// 
//     private String shortName;
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public String getShortName() {
//         return shortName;
//     }
// }
// 
// Path: src/main/java/com/jeanchampemont/wtfdyum/utils/WTFDYUMException.java
// @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR, reason = "WTFDYUMException")
// public class WTFDYUMException extends Exception {
// 
//     private static final long serialVersionUID = 4147162490508812242L;
// 
//     public WTFDYUMException(final Exception e, final WTFDYUMExceptionType type) {
//         super(e);
//         this.type = type;
//     }
// 
//     public WTFDYUMException(final WTFDYUMExceptionType type) {
//         this.type = type;
//     }
// 
//     private final WTFDYUMExceptionType type;
// 
//     public WTFDYUMExceptionType getType() {
//         return type;
//     }
// 
// }


import com.jeanchampemont.wtfdyum.dto.Event;
import com.jeanchampemont.wtfdyum.dto.Feature;
import com.jeanchampemont.wtfdyum.utils.WTFDYUMException;
import java.util.Set;
/*
 * Copyright (C) 2015, 2016 WTFDYUM
 *
 * This file is part of the WTFDYUM project.
 *
 * 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 com.jeanchampemont.wtfdyum.service.feature;



/**
 * This interface should be implemented by all feature's strategies.
 */
public interface FeatureStrategy {

    /**
     * Complete cron.
     *
     * This method is called after all cron for this user have been executed
     *
     * @param userId
     *            the user id
     * @throws WTFDYUMException
     */
    void completeCron(Long userId) throws WTFDYUMException;

    /**
     * Method that should be executed periodically for this feature.
     *
     * @param userId
     *            the user id
     * @return the resulting events set
     * @throws WTFDYUMException
     *             the WTFDYUM exception
     */
    Set<Event> cron(Long userId) throws WTFDYUMException;

    /**
     * Disable the feature for this userId.
     *
     * @param userId
     *            the user id
     * @return true if the feature was enabled and has been disabled, false
     *         otherwise
     */
// Path: src/main/java/com/jeanchampemont/wtfdyum/dto/Event.java
// public class Event {
// 
//     public Event() {
//         // left deliberately empty
//     }
// 
//     public Event(final EventType type, final String additionalData) {
//         this.type = type;
//         this.additionalData = additionalData;
//     }
// 
//     private EventType type;
// 
//     private String additionalData;
// 
//     private LocalDateTime creationDateTime;
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         final Event other = (Event) obj;
//         if (additionalData == null) {
//             if (other.additionalData != null) {
//                 return false;
//             }
//         } else if (!additionalData.equals(other.additionalData)) {
//             return false;
//         }
//         if (creationDateTime == null) {
//             if (other.creationDateTime != null) {
//                 return false;
//             }
//         } else if (!creationDateTime.equals(other.creationDateTime)) {
//             return false;
//         }
//         if (type != other.type) {
//             return false;
//         }
//         return true;
//     }
// 
//     public String getAdditionalData() {
//         return additionalData;
//     }
// 
//     public LocalDateTime getCreationDateTime() {
//         return creationDateTime;
//     }
// 
//     @JsonIgnore
//     public String getMessage() {
//         return String.format(type.getMessage(), additionalData);
//     }
// 
//     public EventType getType() {
//         return type;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(this.type, this.creationDateTime, this.additionalData);
//     }
// 
//     public void setAdditionalData(final String additionalData) {
//         this.additionalData = additionalData;
//     }
// 
//     public void setCreationDateTime(final LocalDateTime creationDateTime) {
//         this.creationDateTime = creationDateTime;
//     }
// 
//     public void setType(final EventType type) {
//         this.type = type;
//     }
// }
// 
// Path: src/main/java/com/jeanchampemont/wtfdyum/dto/Feature.java
// public enum Feature {
// 
//     NOTIFY_UNFOLLOW("Send me a direct message when someone stops following me", "unfollow notifications"),
// 
//     TWEET_UNFOLLOW("Send a public tweet with @mention when someone stops following me", "unfollow tweet");
// 
//     private Feature(final String message, final String shortName) {
//         this.message = message;
//         this.shortName = shortName;
//     }
// 
//     private String message;
// 
//     private String shortName;
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public String getShortName() {
//         return shortName;
//     }
// }
// 
// Path: src/main/java/com/jeanchampemont/wtfdyum/utils/WTFDYUMException.java
// @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR, reason = "WTFDYUMException")
// public class WTFDYUMException extends Exception {
// 
//     private static final long serialVersionUID = 4147162490508812242L;
// 
//     public WTFDYUMException(final Exception e, final WTFDYUMExceptionType type) {
//         super(e);
//         this.type = type;
//     }
// 
//     public WTFDYUMException(final WTFDYUMExceptionType type) {
//         this.type = type;
//     }
// 
//     private final WTFDYUMExceptionType type;
// 
//     public WTFDYUMExceptionType getType() {
//         return type;
//     }
// 
// }


// Path: src/main/java/com/jeanchampemont/wtfdyum/service/feature/FeatureStrategy.java
import com.jeanchampemont.wtfdyum.dto.Event;
import com.jeanchampemont.wtfdyum.dto.Feature;
import com.jeanchampemont.wtfdyum.utils.WTFDYUMException;
import java.util.Set;

/*
 * Copyright (C) 2015, 2016 WTFDYUM
 *
 * This file is part of the WTFDYUM project.
 *
 * 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 com.jeanchampemont.wtfdyum.service.feature;



/**
 * This interface should be implemented by all feature's strategies.
 */
public interface FeatureStrategy {

    /**
     * Complete cron.
     *
     * This method is called after all cron for this user have been executed
     *
     * @param userId
     *            the user id
     * @throws WTFDYUMException
     */
    void completeCron(Long userId) throws WTFDYUMException;

    /**
     * Method that should be executed periodically for this feature.
     *
     * @param userId
     *            the user id
     * @return the resulting events set
     * @throws WTFDYUMException
     *             the WTFDYUM exception
     */
    Set<Event> cron(Long userId) throws WTFDYUMException;

    /**
     * Disable the feature for this userId.
     *
     * @param userId
     *            the user id
     * @return true if the feature was enabled and has been disabled, false
     *         otherwise
     */
    boolean disableFeature(Long userId);