// Path: app/src/main/java/dynoapps/exchange_rates/alarm/Alarm.java
// @Entity(tableName = Alarm.TABLE_NAME)
// public class Alarm implements Serializable {
// 
//     /**
//      * The name of the Alarm table.
//      */
//     public static final String TABLE_NAME = "tables";
// 
//     /**
//      * The name of the ID column.
//      */
//     public static final String COLUMN_ID = BaseColumns._ID;
//     public static Comparator<Alarm> COMPARATOR = (first, second) -> {
// 
//         int i = compare(first.sourceType, second.sourceType);
//         if (i != 0) return i;
// 
//         i = compare(first.rateType, second.rateType);
//         if (i != 0) return i;
// 
//         i = compare(first.val, second.val);
//         return i;
// 
//     };
//     /**
//      * The unique ID of the alarm.
//      */
//     @PrimaryKey(autoGenerate = true)
//     @ColumnInfo(index = true, name = COLUMN_ID)
//     public long id;
//     @ColumnInfo(name = "value")
//     public Float val;
//     @ColumnInfo(name = "is_above")
//     public boolean isAbove = false;
//     @ColumnInfo(name = "is_enabled")
//     public boolean isEnabled = true;
//     /**
//      * {@link dynoapps.exchange_rates.model.rates.IRate}
//      */
//     @ColumnInfo(name = "rate_type")
//     public int rateType;
//     /**
//      * {@link dynoapps.exchange_rates.data.CurrencyType}
//      */
//     @ColumnInfo(name = "source_type")
//     public int sourceType;
//     /**
//      * {@link dynoapps.exchange_rates.interfaces.ValueType}
//      */
//     public int value_type = ValueType.NONE;
// 
//     public static int getPushId(Alarm alarm) {
//         return alarm.rateType * 100 + alarm.sourceType;
//     }
// 
//     private static int compare(int x, int y) {
//         return Integer.compare(x, y);
//     }
// 
//     private static int compare(float x, float y) {
//         return Float.compare(x, y);
//     }
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/alarm/AlarmDao.java
// @Dao
// public interface AlarmDao {
// 
//     /**
//      * Inserts a alarm into the table.
//      *
//      * @param alarm A new alarm.
//      * @return The row ID of the newly inserted alarm.
//      */
//     @Insert
//     Single<Long> insert(Alarm alarm);
// 
//     /**
//      * Inserts multiple alarms into the database
//      *
//      * @param alarms An array of new alarms.
//      * @return The row IDs of the newly inserted alarms.
//      */
//     @Insert
//     long[] insertAll(Alarm[] alarms);
// 
//     /**
//      * Select all alarms.
//      *
//      * @return A {@link Cursor} of all the cheeses in the table.
//      */
//     @Query("SELECT * FROM " + Alarm.TABLE_NAME)
//     Flowable<List<Alarm>> selectAll();
// 
//     /**
//      * Select all alarms.
//      *
//      * @return A {@link Cursor} of all the cheeses in the table.
//      */
//     @Query("SELECT * FROM " + Alarm.TABLE_NAME)
//     Single<List<Alarm>> list();
// 
// 
//     /**
//      * Delete a alarm by the ID.
//      *
//      * @param id The row ID.
//      * @return A number of alarms deleted. This should always be {@code 1}.
//      */
//     @Query("DELETE FROM " + Alarm.TABLE_NAME + " WHERE " + Alarm.COLUMN_ID + " = :id")
//     Single<Integer> deleteById(long id);
// 
//     /**
//      * Update the alarm. The alarm is identified by the row ID.
//      *
//      * @param alarm The alarm to update.
//      * @return A number of alarms updated. This should always be {@code 1}.
//      */
//     @Update
//     Single<Integer> update(Alarm alarm);
// 
// }


import android.content.Context;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import dynoapps.exchange_rates.alarm.Alarm;
import dynoapps.exchange_rates.alarm.AlarmDao;
package dynoapps.exchange_rates;



/**
 * Created by erdemmac on 18/07/2017.
 */

@Database(entities = {Alarm.class}, version = 1, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
    /**
     * The only instance
     */
    private static AppDatabase sInstance;

    /**
     * Gets the singleton instance of SampleDatabase.
     *
     * @param context The context.
     * @return The singleton instance of SampleDatabase.
     */
    public static synchronized AppDatabase getInstance(Context context) {
        if (sInstance == null) {
            sInstance = Room
                    .databaseBuilder(context.getApplicationContext(), AppDatabase.class, "alarms")
                    .build();
        }
        return sInstance;
    }

    /**
     * @return The DAO for the Alarm table.
     */
// Path: app/src/main/java/dynoapps/exchange_rates/alarm/Alarm.java
// @Entity(tableName = Alarm.TABLE_NAME)
// public class Alarm implements Serializable {
// 
//     /**
//      * The name of the Alarm table.
//      */
//     public static final String TABLE_NAME = "tables";
// 
//     /**
//      * The name of the ID column.
//      */
//     public static final String COLUMN_ID = BaseColumns._ID;
//     public static Comparator<Alarm> COMPARATOR = (first, second) -> {
// 
//         int i = compare(first.sourceType, second.sourceType);
//         if (i != 0) return i;
// 
//         i = compare(first.rateType, second.rateType);
//         if (i != 0) return i;
// 
//         i = compare(first.val, second.val);
//         return i;
// 
//     };
//     /**
//      * The unique ID of the alarm.
//      */
//     @PrimaryKey(autoGenerate = true)
//     @ColumnInfo(index = true, name = COLUMN_ID)
//     public long id;
//     @ColumnInfo(name = "value")
//     public Float val;
//     @ColumnInfo(name = "is_above")
//     public boolean isAbove = false;
//     @ColumnInfo(name = "is_enabled")
//     public boolean isEnabled = true;
//     /**
//      * {@link dynoapps.exchange_rates.model.rates.IRate}
//      */
//     @ColumnInfo(name = "rate_type")
//     public int rateType;
//     /**
//      * {@link dynoapps.exchange_rates.data.CurrencyType}
//      */
//     @ColumnInfo(name = "source_type")
//     public int sourceType;
//     /**
//      * {@link dynoapps.exchange_rates.interfaces.ValueType}
//      */
//     public int value_type = ValueType.NONE;
// 
//     public static int getPushId(Alarm alarm) {
//         return alarm.rateType * 100 + alarm.sourceType;
//     }
// 
//     private static int compare(int x, int y) {
//         return Integer.compare(x, y);
//     }
// 
//     private static int compare(float x, float y) {
//         return Float.compare(x, y);
//     }
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/alarm/AlarmDao.java
// @Dao
// public interface AlarmDao {
// 
//     /**
//      * Inserts a alarm into the table.
//      *
//      * @param alarm A new alarm.
//      * @return The row ID of the newly inserted alarm.
//      */
//     @Insert
//     Single<Long> insert(Alarm alarm);
// 
//     /**
//      * Inserts multiple alarms into the database
//      *
//      * @param alarms An array of new alarms.
//      * @return The row IDs of the newly inserted alarms.
//      */
//     @Insert
//     long[] insertAll(Alarm[] alarms);
// 
//     /**
//      * Select all alarms.
//      *
//      * @return A {@link Cursor} of all the cheeses in the table.
//      */
//     @Query("SELECT * FROM " + Alarm.TABLE_NAME)
//     Flowable<List<Alarm>> selectAll();
// 
//     /**
//      * Select all alarms.
//      *
//      * @return A {@link Cursor} of all the cheeses in the table.
//      */
//     @Query("SELECT * FROM " + Alarm.TABLE_NAME)
//     Single<List<Alarm>> list();
// 
// 
//     /**
//      * Delete a alarm by the ID.
//      *
//      * @param id The row ID.
//      * @return A number of alarms deleted. This should always be {@code 1}.
//      */
//     @Query("DELETE FROM " + Alarm.TABLE_NAME + " WHERE " + Alarm.COLUMN_ID + " = :id")
//     Single<Integer> deleteById(long id);
// 
//     /**
//      * Update the alarm. The alarm is identified by the row ID.
//      *
//      * @param alarm The alarm to update.
//      * @return A number of alarms updated. This should always be {@code 1}.
//      */
//     @Update
//     Single<Integer> update(Alarm alarm);
// 
// }


// Path: app/src/main/java/dynoapps/exchange_rates/AppDatabase.java
import android.content.Context;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import dynoapps.exchange_rates.alarm.Alarm;
import dynoapps.exchange_rates.alarm.AlarmDao;

package dynoapps.exchange_rates;



/**
 * Created by erdemmac on 18/07/2017.
 */

@Database(entities = {Alarm.class}, version = 1, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
    /**
     * The only instance
     */
    private static AppDatabase sInstance;

    /**
     * Gets the singleton instance of SampleDatabase.
     *
     * @param context The context.
     * @return The singleton instance of SampleDatabase.
     */
    public static synchronized AppDatabase getInstance(Context context) {
        if (sInstance == null) {
            sInstance = Room
                    .databaseBuilder(context.getApplicationContext(), AppDatabase.class, "alarms")
                    .build();
        }
        return sInstance;
    }

    /**
     * @return The DAO for the Alarm table.
     */
    public abstract AlarmDao alarm();