package com.beem.project.beem.provider;

import android.net.Uri;
import android.provider.BaseColumns;

/**
 * Convenience definitions for BEEM's providers.
 */
public final class Beem {

    /**
     * Contacts table.
     */
    public static final class Contacts implements BaseColumns {

	/**
	 * The query used to create the table.
	 */
	public static final String QUERY_CREATE = "CREATE TABLE " + Beem.CONTACTS_TABLE_NAME + " (" + BaseColumns._ID
	    + " INTEGER PRIMARY KEY AUTOINCREMENT," + Contacts.UID + " INTEGER, " + Contacts.JID + " INTEGER,"
	    + Contacts.NICKNAME + " TEXT," + Contacts.ALIAS + " TEXT," + Contacts.DATE_CREATED + " INTEGER,"
	    + Contacts.DATE_MODIFIED + " INTEGER" + ");";

	/**
	 * The content:// style URL for Contacts table.
	 */
	public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/contacts");

	/**
	 * The MIME type of {@link #CONTENT_URI} providing a directory of contacts.
	 */
	public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.beem.project.contact";

	/**
	 * The MIME type of a {@link #CONTENT_URI} sub-directory of a single contact.
	 */
	public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.beem.project.contact";

	/**
	 * The default sort order for this table.
	 */
	public static final String DEFAULT_SORT_ORDER = "nickname ASC";

	/**
	 * The user id having the contact
	 * <P>
	 * Type: INTEGER
	 * </P>
	 * .
	 */
	public static final String UID = "uid";

	/**
	 * The JabberID of the contact
	 * <P>
	 * Type: INTEGER
	 * </P>
	 * .
	 */
	public static final String JID = "jid";

	/**
	 * The nickname of the contact
	 * <P>
	 * Type: TEXT
	 * </P>
	 * .
	 */
	public static final String NICKNAME = "nickname";

	/**
	 * The alias of the contact
	 * <P>
	 * Type: TEXT
	 * </P>
	 * .
	 */
	public static final String ALIAS = "alias";

	/**
	 * The timestamp for when the contact was created
	 * <P>
	 * Type: INTEGER (long from System.curentTimeMillis())
	 * </P>
	 * .
	 */
	public static final String DATE_CREATED = "created";

	/**
	 * The timestamp for when the contact was last modified
	 * <P>
	 * Type: INTEGER (long from System.curentTimeMillis())
	 * </P>
	 * .
	 */
	public static final String DATE_MODIFIED = "modified";

    }

    /**
     * Users table.
     */
    public static final class Users implements BaseColumns {

	/**
	 * The query used to create the table.
	 */
	public static final String QUERY_CREATE = "CREATE TABLE " + Beem.USERS_TABLE_NAME + " (" + BaseColumns._ID
	    + " INTEGER PRIMARY KEY AUTOINCREMENT," + Users.JUSERNAME + " TEXT," + Users.DATE_CREATED + " INTEGER,"
	    + Users.DATE_MODIFIED + " INTEGER" + ");";

	/**
	 * The content:// style URL for Contacts table.
	 */
	public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/users");

	/**
	 * The MIME type of {@link #CONTENT_URI} providing a directory of users.
	 */
	public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.beem.project.user";

	/**
	 * The MIME type of a {@link #CONTENT_URI} sub-directory of a single user.
	 */
	public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.beem.project.user";

	/**
	 * The default sort order for this table.
	 */
	public static final String DEFAULT_SORT_ORDER = "_id ASC";

	/**
	 * The Jabber username of the user
	 * <P>
	 * Type: TEXT
	 * </P>
	 * .
	 */
	public static final String JUSERNAME = "username";

	/**
	 * The timestamp for when the user was created
	 * <P>
	 * Type: INTEGER (long from System.curentTimeMillis())
	 * </P>
	 * .
	 */
	public static final String DATE_CREATED = "created";

	/**
	 * The timestamp for when the user was last modified
	 * <P>
	 * Type: INTEGER (long from System.curentTimeMillis())
	 * </P>
	 * .
	 */
	public static final String DATE_MODIFIED = "modified";
    }

    /**
     * AUTHORITY.
     */
    public static final String AUTHORITY = "com.beem.project.provider";

    /**
     * DB Name.
     */
    public static final String DB_NAME = "beem.db";

    /**
     * DB Version.
     */
    public static final int DB_VERSION = 2;

    /**
     * Name of the users table.
     */
    public static final String USERS_TABLE_NAME = "users";

    /**
     * Name of the contacts table.
     */
    public static final String CONTACTS_TABLE_NAME = "contacts";

    /**
     * Constructor.
     */
    private Beem() {
    }
}
