/* ======================================================================
   Parts Copyright 2006 University of Leeds, Oxford University, University of the Highlands and Islands.

   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 org.bodington.server;

import org.bodington.server.realm.User;
import org.bodington.server.resources.Resource;

public interface HomeContainerSession extends BuildingSession
{

    /**
     * Check if the user has a home space in this resource.
     * @param user The user to check against. <code>null</code> not allowed
     * @return True if the user has a home space.
     * @throws BuildingServerException TODO
     */
    public boolean hasHome(User user) throws BuildingServerException;
    
    /**
     * Create a space for the user inside this container.
     * @param user The user to create the space for.
     * @throws BuildingServerException TODO
     */
    public void createHome(User user) throws BuildingServerException;
    
    /**
     * Find the home space for the selected user.
     * @param user The user to find the resource for.
     * @return The resouce of the that is the home space for the user.
     * @throws BuildingServerException TODO
     */
    public Resource findHome(User user) throws BuildingServerException;
    
    /**
     * Get the terms and conditions for the user.
     * @param user The user which the terms are wanted for.
     * @return A string for the terms and conditions. <code>null</code> is there
     * aren't any.
     * @throws BuildingServerException If there should be terms and conditions 
     * but we had a problem loading them.
     */
    public String getTerms(User user) throws BuildingServerException;
    
    /**
     * Check if a user can create their own area.
     * @param user The user to check
     * @return <code>true</code> if the user can create thier own space.
     * @throws BuildingServerException
     */
    public boolean canCreateHome(User user) throws BuildingServerException;
}
