package com.example.tabbuy.data.local.dao

import androidx.room.*
import com.example.tabbuy.data.local.entity.PelangganEntity

@Dao
interface PelangganDao {
    @Query("SELECT * FROM pelanggan")
    suspend fun getAllPelanggan(): List<PelangganEntity>

    @Query("SELECT * FROM pelanggan WHERE email = :email LIMIT 1")
    suspend fun getPelangganByEmail(email: String): PelangganEntity?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(pelanggan: PelangganEntity)

    @Update
    suspend fun update(pelanggan: PelangganEntity)

    @Delete
    suspend fun delete(pelanggan: PelangganEntity)
}
