package doc.walkthru;

import java.net.URL;
import java.util.List;

import org.benow.repository.NoSuchObjectException;
import org.benow.security.permission.Permission.AnonymousAccess;
import org.benow.security.permission.Permission.RequiresPermission;
import org.benow.service.Service;

@AnonymousAccess
public interface PerformerService extends Service {
  /**
   * @return known performers
   */
  @AnonymousAccess
  public List<Performer> getPerformers();

  /**
   * Get a performer of a certain type (GroupImpl, ArtistImpl) by key.
   * 
   * @param key
   * @param type
   * @return
   * @throws NoSuchObjectException 
   */
  @AnonymousAccess
  public Performer getPerformerByKey(Object key, Class<?> type) throws NoSuchObjectException;

  /**
   * Create a group with the given name
   * 
   * @param name
   * @return
   */
  @RequiresPermission("create")
  public Group createGroup(String name);

  /**
   * Add a member to the group
   * 
   * @param group
   * @param artist
   */
  @RequiresPermission("create")
  public void addGroupMember(Group group, Artist artist);

  /**
   * Create an artist with the given name
   * 
   * @param name
   * @return
   */
  @RequiresPermission("create")
  public Artist createArtist(String name);

  /**
   * Add a link to a performer
   * 
   * @param performer
   * @param link
   */
  @RequiresPermission("modify")
  public void addPerformerLink(Performer performer, URL link);

  /**
   * Remove a stale link from the performer
   * 
   * @param performer
   * @param link
   */
  @RequiresPermission("modify")
  public void removePerformerLink(Performer performer, URL link);

  /**
   * Gets the albums of a performer
   * 
   * @param performer
   * @return
   */
  @AnonymousAccess
  public List<Album> getPerformerAlbums(Performer performer);

}

