using Microsoft.AspNetCore.Authorization;

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MTWorkHR.Application.Filters;
using MTWorkHR.Application.Models;
using MTWorkHR.Application.Services;
using MTWorkHR.Application.Services.Interfaces;

namespace MTWorkHR.API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    [AppAuthorize]
    public class AttachmentController : ControllerBase
    {
        private readonly IFileService _fileService;

        public AttachmentController(IFileService fileService)
        {
            _fileService = fileService;
        }
        

        [HttpPost("Upload")]
        [ProducesResponseType(StatusCodes.Status200OK)]
        [Consumes("multipart/form-data")]
        public async Task<ActionResult<AttachmentResponseDto>> Upload(IFormFile input)
        {
            return Ok( await _fileService.UploadFile(input));
        }


    }
}
