package in.techware.carrefour.dbUtils.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import java.util.List;

import in.techware.afcetcbus.database.entity.LocationEntity;

/**
 * Created by Jemsheer K D on 13 February, 2018.
 * Package in.techware.dearest.dbUtils.dao
 * Project Carrefour
 */

@Dao
public interface LocationDao {

    @Query("SELECT * FROM location")
    List<LocationEntity> loadAllLocations();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertAll(List<LocationEntity> locationEntityList);


    @Query("select * from location where id = :id ORDER BY id DESC LIMIT 1")
    List<LocationEntity> getLocation(String id);

    @Query("DELETE FROM location")
    void deleteAll();

    @Insert
    void insert(LocationEntity locationEntity);

    @Update
    void update(LocationEntity locationEntity);

    @Delete
    void delete(LocationEntity locationEntity);

}
