using Edge.Core.Domain.FccMachineInfo.Input;
using FccLite.Web.Services.FccMachineInfo;
using Microsoft.AspNetCore.Mvc;

namespace FccLite.Web.Controller
{
    [Route("qrFueling/machine")]
    [ApiController]
    public class MachineController : ControllerBase
    {
        private IMachineService _machineService;

        public MachineController(IMachineService machineService)
        {
            _machineService = machineService;
        }

        [HttpGet("getMachineInfo")]
        public async Task<IActionResult> GetMachineInfo(long stationId)
        {
            List<Edge.Core.Domain.FccMachineInfo.Output.MachineInfoOutput> machineInfoOutputs = await _machineService.GetMachineInfo(stationId);
            return Ok(machineInfoOutputs);
        }

        [HttpPost("uploadMachineInfo")]
        public async Task<IActionResult> UploadMachine(UploadMachineInfo uploadMachineInfo)
        {
            Edge.Core.Domain.FccMachineInfo.Output.SetMachineInfoOutput setMachineInfoOutput = await _machineService.UploadMachine(uploadMachineInfo);
            return Ok(setMachineInfoOutput);
        }

        [HttpPost("deleteMaichineInfo")]
        public async Task<IActionResult> DeleteMachine(long machineId)
        {
            Edge.Core.Domain.FccMachineInfo.Output.SetMachineInfoOutput setMachineInfoOutput = await _machineService.DeleteMachine(machineId);
            return Ok(setMachineInfoOutput);
        }
    }
}
