package com.xplora.contactprovider.dao

import android.database.Cursor
import androidx.room.*

@Dao
interface ContactDao {
    @Query("SELECT * FROM contact")
    fun query(): Cursor

    @Query("SELECT * FROM contact WHERE _id=:id")
    fun queryById(id: Long): ContactInfo

    @Query("SELECT * FROM contact WHERE _id=:id")
    fun queryByIdForApp(id: Long): Cursor

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(contactInfo: ContactInfo): Long

    @Delete
    fun delete(info: ContactInfo): Int

    @Update(onConflict = OnConflictStrategy.REPLACE)
    fun update(contactInfo: ContactInfo): Int
}