package com.fchaps.model;

/**
 * The User
 *
 * @hibernate.class    table="usr"
 *                     mutable="true"
 *                     proxy="com.fchaps.model.User"
 */
public interface User {

    public static final User GUEST = new User() {
        public Long getId() { return null; }
        public void setId(Long id) { throw new UnsupportedOperationException(); }
        public String getUsername() { return null; }
        public void setUsername(String username) { throw new UnsupportedOperationException(); }
        public String getPassword() { return null; }
        public void setPassword(String password) { throw new UnsupportedOperationException(); }
        public UserType getType() { return UserType.GUEST; }
        public void setType(UserType type) { throw new UnsupportedOperationException(); }
        public Player getPlayer() { return null; }
        public void setPlayer(Player player) { throw new UnsupportedOperationException(); }
        public Boolean isDisabled() { return Boolean.FALSE; }
        public void setDisabled(Boolean disabled) { throw new UnsupportedOperationException(); }
    };

    /**
     * User identifier
     *
     * @hibernate.id   column="usr_id"
     *                 unsaved-value="null"
     *                 generator-class="native"
     *
     * @return
     */
    public Long getId();
    public void setId(Long id);

    /**
     * User's username
     *
     * @hibernate.property column="username"
     *                     not-null="true"
     *                     unique="true"
     *
     * @return
     */
    public String getUsername();
    public void setUsername(String username);

    /**
     * User's password
     *
     * @hibernate.property column="password"
     *                     not-null="true"
     *                     unique="false"
     *
     * @return
     */
    public String getPassword();
    public void setPassword(String password);

    /**
     * User's type (the rights level)
     *
     * @hibernate.property column="type"
     *                     not-null="false"
     *                     unique="false"
     *
     * @return
     */
    public UserType getType();
    public void setType(UserType type);

    /**
     * If user is also a player then this is the player object for him
     *
     * @hibernate.many-to-one  column="player_id"
     *                         cascade="save-update"
     *                         class="com.fchaps.model.Player"
     *                         outer-join="auto"
     *                         unique="false"
     *
     * @return
     */
    public Player getPlayer();
    public void setPlayer(Player player);

    /**
     * User's disabled status
     *
     * @hibernate.property column="disabled"
     *                     not-null="false"
     *                     unique="false"
     *
     * @return
     */
    public Boolean isDisabled();
    public void setDisabled(Boolean disabled);

}
