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.carrefour.dbUtils.entity.TransformQuantityEntity;


/**
 * Created by Jemsheer K D on 25 July, 2018.
 * Package in.techware.carrefour.dbUtils.dao
 * Project Carrefour
 */

@Dao
public interface TransformQuantityDao {

    @Query("SELECT * FROM transformQuantity")
    List<TransformQuantityEntity> loadAllTransformQuantitys();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertAll(List<TransformQuantityEntity> transformQuantityEntityList);


    @Query("select * from transformQuantity where id = :id ORDER BY id DESC LIMIT 1")
    List<TransformQuantityEntity> getTransformQuantity(String id);

    @Query("select * from transformQuantity where sendStatus = 0 ORDER BY id")
    List<TransformQuantityEntity> getAllUnsentTransformQuantity();

    @Query("select * from transformQuantity where sendStatus = 1 ORDER BY id")
    List<TransformQuantityEntity> getAllSentTransformQuantity();

    @Query("DELETE from transformQuantity where sendStatus = 0")
    void deleteAllUnsentTransformQuantity();

    @Query("DELETE from transformQuantity where sendStatus = 1")
    void deleteAllSentTransformQuantity();

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

    @Insert
    long insert(TransformQuantityEntity transformQuantityEntity);

    @Update
    void update(TransformQuantityEntity transformQuantityEntity);

    @Delete
    void delete(TransformQuantityEntity transformQuantityEntity);
}
