package de.dtele.data {
  
  import de.dtele.net.Connection;
  
  import mx.collections.ListCollectionView;
  import mx.utils.ObjectProxy;
  
  /**
   * Interface for source objects
   * 
   * <p>Sources have a unique connection and resources attached to them.
   * They also store data about which kind of requests are accepted
   * and restricted. For the latter credentials can be stored to re-
   * use them after successful requests.</p>
   * 
   * @author Mathias Brodala
   */
  public interface ISource {
    
    /* Properties */
    /**
     * The URL of this source
     */
    function get url():String;
    
    /**
     * The list of resources provided by this source
     */
    function get resources():ListCollectionView;
    
    /**
     * Properties of this source
     */
    function get properties():ObjectProxy;
    
    /**
     * Allowed request types for this source
     */
    function get allowed():ObjectProxy;
    
    /**
     * Restricted request types for this source
     */
    function get restricted():ObjectProxy;
    
    /**
     * Credentials for restricted request types for this source
     */
    function get credentials():ObjectProxy;
    
    /**
     * The connection of this source
     */
    function get connection():Connection;
    /**
     * Sets the connection of this source
     * 
     * @param connection The connection
     */
    function set connection(connection:Connection):void;
    
    function requiresCredentials(requestType:String):Boolean;
  }
}