package com.cpm.lorealbaMabeline.bulkInsert;

import android.content.ContentResolver;
import android.content.ContentUris;
import android.net.Uri;
import android.provider.BaseColumns;

import com.cpm.lorealbaMabeline.BuildConfig;

public class DBContract {
    /*Content Authority its a name for the content provider, is convenient to use the
     package app name to be unique on the device */
    public static final String CONTENT_AUTHORITY = BuildConfig.APPLICATION_ID;

    //Use CONTENT_AUTHORITY to create all the database URI's that
    // the app will use to link the content provider.
    public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);

    /*the name of the uri that can be the same as the name of your table.
    this will translate to content://com.yourdomain.yourapp/user/ as a valid URI
    */
    public static final String PATH_USER = "User";

    // To prevent someone from accidentally instantiating the contract class,
    // give it an empty constructor.
    public DBContract() {
    }

    //Intern class that defines the user table
    public static final class UserEntry implements BaseColumns {
        public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().
                appendPath(PATH_USER).build();

        public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_USER;

        //Name of the table
        public static final String TABLE_NAME = "User";
        //Columns of the user table
        public static final String COLUMN_Name = "Name";
        public static final String COLUMN_Password = "Password";
        public static Uri buildUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }
    }
}
