/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * 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 com.vinnypalumbo.popularmovies.data;

import android.provider.BaseColumns;
import android.text.format.Time;

/**
 * Defines table and column names for the movie database.
 */
public class MovieContract {

    // To make it easy to query for the exact date, we normalize all dates that go into
    // the database to the start of the the Julian day at UTC.
    public static long normalizeDate(long startDate) {
        // normalize the start date to the beginning of the (UTC) day
        Time time = new Time();
        time.set(startDate);
        int julianDay = Time.getJulianDay(startDate, time.gmtoff);
        return time.setJulianDay(julianDay);
    }

    /*
        Inner class that defines the table contents of the location table
        Students: This is where you will add the strings.  (Similar to what has been
        done for MovieEntry)
     */
    public static final class LocationEntry implements BaseColumns {
        public static final String TABLE_NAME = "location";

    }

    /* Inner class that defines the table contents of the movie table */
    public static final class MovieEntry implements BaseColumns {

        public static final String TABLE_NAME = "movie";

        // Column with the foreign key into the location table.
        public static final String COLUMN_LOC_KEY = "location_id";
        // Date, stored as long in milliseconds since the epoch
        public static final String COLUMN_DATE = "date";
        // Movie id as returned by API, to identify the icon to be used
        public static final String COLUMN_MOVIE_ID = "movie_id";

        // Short description and long description of the movie, as provided by API.
        // e.g "clear" vs "sky is clear".
        public static final String COLUMN_SHORT_DESC = "short_desc";

        // Min and max temperatures for the day (stored as floats)
        public static final String COLUMN_MIN_TEMP = "min";
        public static final String COLUMN_MAX_TEMP = "max";

        // Humidity is stored as a float representing percentage
        public static final String COLUMN_HUMIDITY = "humidity";

        // Humidity is stored as a float representing percentage
        public static final String COLUMN_PRESSURE = "pressure";

        // Windspeed is stored as a float representing windspeed  mph
        public static final String COLUMN_WIND_SPEED = "wind";

        // Degrees are meteorological degrees (e.g, 0 is north, 180 is south).  Stored as floats.
        public static final String COLUMN_DEGREES = "degrees";
    }
}

/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * 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 com.vinnypalumbo.popularmovies.data;

import android.provider.BaseColumns;

/**
 * Defines table and column names for the movie database.
 */
public class MovieContract {


    /*
        Inner class that defines the contents of the watchlist table
     */
    public static final class WatchlistEntry implements BaseColumns {
        public static final String TABLE_NAME = "watchlist";

        // Movie id as returned by API. Stored as int.
        public static final String COLUMN_MOVIE_ID = "movie_id";

        // Title of the movie.
        public static final String COLUMN_TITLE = "title";

        // Movie Poster. Stored as string.
        public static final String COLUMN_POSTER = "poster";

        // Movie synopsis.
        public static final String COLUMN_PLOT = "plot";

        // Movie vote average. Stored as floats
        public static final String COLUMN_RATING = "rating";

        // Movie Release Date
        public static final String COLUMN_DATE = "date";

    }

    /* Inner class that defines the contents of the movie table */
    public static final class MovieEntry implements BaseColumns {

        public static final String TABLE_NAME = "movie";

        // Movie id as returned by API. Stored as int.
        public static final String COLUMN_MOVIE_ID = "movie_id";

        // Title of the movie. Stored as a string.
        public static final String COLUMN_TITLE = "title";

        // Movie Poster. Stored as string.
        public static final String COLUMN_POSTER = "poster";

        // Movie synopsis. Stored as a string.
        public static final String COLUMN_PLOT = "plot";

        // Movie vote average. Stored a float.
        public static final String COLUMN_RATING = "rating";

        // Movie Release Date. Stored as a string.
        public static final String COLUMN_DATE = "date";

    }
}

Define constants in Contract