using DomainResults.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WeatherForecast.Models.Requests;
using WeatherForecast.Services;

namespace WeatherForecast.Controllers;

/// <summary>
/// 
/// </summary>
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class PasswordController : ControllerBase {

  private readonly IPasswordService _passwordService;

  /// <summary>
  /// 
  /// </summary>
  /// <param name="passwordService"></param>
  public PasswordController(
    IPasswordService passwordService
  ) {
    _passwordService = passwordService;
  }

  /// <summary>
  /// 
  /// </summary>
  /// <param name="siteId"></param>
  /// <param name="userId"></param>
  /// <param name="requestData"></param>
  /// <returns></returns>
  [HttpPost("{siteId}/{userId}")]
  public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromBody] PasswordRequestModel requestData) {
    var result = _passwordService.Post(siteId, userId, requestData);
    return result.ToActionResult();
  }
}

