// Path: osuCelebrity-model/src/main/java/me/reddev/osucelebrity/core/QueuedPlayer.java
// @Data
// @PersistenceCapable
// public class QueuedPlayer {
//   public static final int CANCELLED = -2;
//   public static final int DONE = -1;
//   public static final int SPECTATING = 0;
//   public static final int NEXT = 1;
//   public static final int QUEUED = 2;
// 
//   @PrimaryKey
//   @Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT)
//   long id;
// 
//   OsuUser player;
// 
//   QueueSource queueSource;
// 
//   long queuedAt;
// 
//   long startedAt;
// 
//   long stoppingAt;
//   
//   @Column(defaultValue = "0")
//   long lastRemainingTimeUpdate;
// 
//   @Index
//   int state = 2;
//   
//   @Column(defaultValue = "0")
//   int boost = 0;
//   
//   /**
//    * Creates a new queued player object. This alone won't enqueue this player.
//    * 
//    * @param queuedPlayer the queued player's user object.
//    * @param queueSource the user interface via which this player was enqued.
//    * @param queuedAt current time.
//    */
//   public QueuedPlayer(OsuUser queuedPlayer, QueueSource queueSource, long queuedAt) {
//     super();
//     this.player = queuedPlayer;
//     this.queueSource = queueSource;
//     this.queuedAt = queuedAt;
//   }
// 
//   @Override
//   public boolean equals(Object other) {
//     if (other instanceof QueuedPlayer) {
//       QueuedPlayer otherUser = (QueuedPlayer) other;
//       return otherUser.player.getUserId() == player.getUserId();
//     }
//     return false;
//   }
// 
//   @Override
//   public int hashCode() {
//     return player != null ? player.getUserId() : 0;
//   }
// 
//   public enum QueueSource {
//     TWITCH, OSU, AUTO
//   }
//   
//   public boolean isNotify() {
//     return queueSource != QueueSource.AUTO && player.isAllowsNotifications();
//   }
// }


import me.reddev.osucelebrity.PassAndReturnNonnull;
import me.reddev.osucelebrity.core.QueuedPlayer;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import javax.annotation.CheckForNull;
import javax.jdo.PersistenceManager;
package me.reddev.osucelebrity.twitchapi;




@PassAndReturnNonnull
public interface TwitchApi {
  /**
   * Gets a list of moderators currently in a channel.
   * 
   * @return The list of moderator usernames in lowercase
   */
  List<String> getOnlineMods();

  /**
   * Determines whether a given user is a moderator of a channel.
   * 
   * @param username The username of the user
   * @return True if the user is a moderator
   */
  boolean isModerator(String username);

  /**
   * Retrieves the user from the API.
   * @param username username (all lower case).
   * @param maxAge if > 0, cached data up to this age can be returned.
   * @param returnCachedOnIoException if true, a cached data is used if a server exception
   *        occurrs during an update from the api
   * @return the user object.
   */
  TwitchApiUser getUser(PersistenceManager pm, String username, long maxAge,
      boolean returnCachedOnIoException);
  
  /**
   * Retrieves the link to the past broadcast that a play occurred in at the exact time when the
   * play started.
   * 
   * @param play any play.
   * @return the full URL. if no matching past broadcast can be found, null.
   */
  @CheckForNull
// Path: osuCelebrity-model/src/main/java/me/reddev/osucelebrity/core/QueuedPlayer.java
// @Data
// @PersistenceCapable
// public class QueuedPlayer {
//   public static final int CANCELLED = -2;
//   public static final int DONE = -1;
//   public static final int SPECTATING = 0;
//   public static final int NEXT = 1;
//   public static final int QUEUED = 2;
// 
//   @PrimaryKey
//   @Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT)
//   long id;
// 
//   OsuUser player;
// 
//   QueueSource queueSource;
// 
//   long queuedAt;
// 
//   long startedAt;
// 
//   long stoppingAt;
//   
//   @Column(defaultValue = "0")
//   long lastRemainingTimeUpdate;
// 
//   @Index
//   int state = 2;
//   
//   @Column(defaultValue = "0")
//   int boost = 0;
//   
//   /**
//    * Creates a new queued player object. This alone won't enqueue this player.
//    * 
//    * @param queuedPlayer the queued player's user object.
//    * @param queueSource the user interface via which this player was enqued.
//    * @param queuedAt current time.
//    */
//   public QueuedPlayer(OsuUser queuedPlayer, QueueSource queueSource, long queuedAt) {
//     super();
//     this.player = queuedPlayer;
//     this.queueSource = queueSource;
//     this.queuedAt = queuedAt;
//   }
// 
//   @Override
//   public boolean equals(Object other) {
//     if (other instanceof QueuedPlayer) {
//       QueuedPlayer otherUser = (QueuedPlayer) other;
//       return otherUser.player.getUserId() == player.getUserId();
//     }
//     return false;
//   }
// 
//   @Override
//   public int hashCode() {
//     return player != null ? player.getUserId() : 0;
//   }
// 
//   public enum QueueSource {
//     TWITCH, OSU, AUTO
//   }
//   
//   public boolean isNotify() {
//     return queueSource != QueueSource.AUTO && player.isAllowsNotifications();
//   }
// }


// Path: osuCelebrity-model/src/main/java/me/reddev/osucelebrity/twitchapi/TwitchApi.java
import me.reddev.osucelebrity.PassAndReturnNonnull;
import me.reddev.osucelebrity.core.QueuedPlayer;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import javax.annotation.CheckForNull;
import javax.jdo.PersistenceManager;

package me.reddev.osucelebrity.twitchapi;




@PassAndReturnNonnull
public interface TwitchApi {
  /**
   * Gets a list of moderators currently in a channel.
   * 
   * @return The list of moderator usernames in lowercase
   */
  List<String> getOnlineMods();

  /**
   * Determines whether a given user is a moderator of a channel.
   * 
   * @param username The username of the user
   * @return True if the user is a moderator
   */
  boolean isModerator(String username);

  /**
   * Retrieves the user from the API.
   * @param username username (all lower case).
   * @param maxAge if > 0, cached data up to this age can be returned.
   * @param returnCachedOnIoException if true, a cached data is used if a server exception
   *        occurrs during an update from the api
   * @return the user object.
   */
  TwitchApiUser getUser(PersistenceManager pm, String username, long maxAge,
      boolean returnCachedOnIoException);
  
  /**
   * Retrieves the link to the past broadcast that a play occurred in at the exact time when the
   * play started.
   * 
   * @param play any play.
   * @return the full URL. if no matching past broadcast can be found, null.
   */
  @CheckForNull
  URL getReplayLink(QueuedPlayer play) throws IOException;