using System.Collections.Generic;
using System.Linq;
using CounterDrone.Core.Models;
using SQLite;

namespace CounterDrone.Core.Repository
{
    public class RoutePlanRepository : BaseRepository<RoutePlan>
    {
        public RoutePlanRepository(SQLiteConnection db) : base(db) { }

        public List<RoutePlan> GetByScenarioId(string scenarioId)
        {
            return Db.Table<RoutePlan>().Where(r => r.ScenarioId == scenarioId).ToList();
        }

        public RoutePlan GetByScenarioAndWave(string scenarioId, string waveId)
        {
            return Db.Table<RoutePlan>()
                .FirstOrDefault(r => r.ScenarioId == scenarioId && r.WaveId == waveId);
        }
    }
}
