package com.auto.clicker.autoclicker.room.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import com.auto.clicker.autoclicker.room.entity.EventEntity;

import java.util.List;

@Dao
public interface EventEntityDao {
    @Insert
    long insertEventEntity(EventEntity eventEntity); // 返回新插入的 eventId

    @Delete
    int deleteEventEntity(EventEntity eventEntity);

    // 查询某个方案下的所有事件实体，按顺序排序
    @Query("SELECT * FROM events WHERE solution_id = :solutionId ORDER BY order_in_solution ASC")
    List<EventEntity> getEventsForSolution(long solutionId);
}
