using BHServer.Data;
using Microsoft.AspNetCore.Mvc;
using BHServer.Models;
using Newtonsoft.Json;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace BHServer.Controllers
{
    [Route("api/[controller]")]
    public class AssaultTroopController(ApplicationDbContext db) : DBController(db)
    {
       
        // GET: api/<APIController>
        [HttpGet]
        public string Get()
        {
            List<AssaultTroop> assaultTroopList = DB.assault_troop.ToList();
            return JsonConvert.SerializeObject(assaultTroopList);
        }
        
        // GET /<APIController>/5
        [HttpGet("{id}")]
        public string Get(int id)
        {
            AssaultTroop assaultTroop = DB.assault_troop.ElementAt(id);
            return JsonConvert.SerializeObject(assaultTroop);
        }

        // POST /<APIController>
        [HttpPost]
        public void Post([FromBody] string value)
        {
            //TODO: Implement
        }

        // PUT /<APIController>/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody] string value)
        {
            //TODO: Implement
        }

        // DELETE /<APIController>/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
            //TODO: Implement
        }
    }
}
