using e_suite.API.Common.models;
using e_suite.Utilities.Pagination;
using eSuite.API.Models;
using eSuite.API.security;
using eSuite.API.Utilities;
using eSuite.Core.Miscellaneous;
using eSuite.Core.Security;
using Microsoft.AspNetCore.Mvc;

namespace eSuite.API.Controllers;

/// <summary>
/// User manage is responsible for managing users within e-suite.
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class WorkflowTemplateController : ESuiteControllerBase
{
    /// <summary>
    /// Get a list of workflow templates
    /// </summary>
    /// <param name="paging"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    /// <exception cref="NotImplementedException"></exception>
    [Route("templates")]
    [AccessKey(SecurityAccess.ViewWorkflowTemplates)]
    [HttpGet]
    public async Task<IActionResult> GetWorkflowTemplates([FromQuery] Paging paging,CancellationToken cancellationToken = default!)
    {
        throw new NotImplementedException();
    }

    /// <summary>
    /// Get the details of specific template
    /// </summary>
    /// <param name="generalIdRef"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    [Route("template")]
    [HttpGet]
    [AccessKey(SecurityAccess.ViewWorkflowTemplates)]
    [ProducesResponseType(StatusCodes.Status200OK)]
    [ProducesResponseType(StatusCodes.Status400BadRequest)]
    [ProducesResponseType(StatusCodes.Status404NotFound)]
    public async Task<IActionResult> GetUser(
        [FromQuery] GeneralIdRef generalIdRef,
        CancellationToken cancellationToken = default!
    )
    {
        throw new NotImplementedException();
    }

    /// <summary>
    /// Edit a Workflow Template
    /// </summary>
    /// <param name="user"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    [Route("template")]
    [HttpPut]
    [ProducesResponseType(StatusCodes.Status200OK)]
    [ProducesResponseType(StatusCodes.Status400BadRequest)]
    [AccessKey(SecurityAccess.EditWorkflowTemplate)]
    public async Task<IActionResult> EditTemplate(EditUser template, CancellationToken cancellationToken = default!)
    {
        throw new NotImplementedException();
    }

    /// <summary>
    /// Patching is useful when you only want to update a few fields of the user rather than the whole object.
    /// </summary>
    /// <param name="user"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    [Route("template")]
    [HttpPatch]
    [ProducesResponseType(StatusCodes.Status200OK)]
    [ProducesResponseType(StatusCodes.Status400BadRequest)]
    [AccessKey(SecurityAccess.EditWorkflowTemplate)]
    public async Task<IActionResult> PatchUser([FromQuery] IGeneralIdRef templateId, [FromBody] PatchUser patchTemplate, CancellationToken cancellationToken = default!)
    {
        throw new NotImplementedException();
    }

    /// <summary>
    /// Create a new workflow template
    /// </summary>
    /// <remarks>Create a new user for e-suite.  The minimum information needed is the email address, which forms the account user name.  Once created the user will get an e-mail asking them to confirm the account.</remarks>
    /// <param name="userRegistration">Contains the details that need to be supplied to create the user.</param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    [Route("template")]
    [HttpPost]
    [ProducesResponseType(StatusCodes.Status200OK)]
    [ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ProblemDetails))]
    [AccessKey(SecurityAccess.AddWorkflowTemplate)]
    public async Task<IActionResult> CreateUser(
        [FromBody] UserRegistration userRegistration,
        CancellationToken cancellationToken = default!
    )
    {
        throw new NotImplementedException();
    }

    /// <summary>
    /// Use this to deactivate a template
    /// </summary>
    /// <param name="email"></param>
    /// <param name="cancellationToken"></param>
    [Route("template")]
    [HttpDelete]
    [ProducesResponseType(StatusCodes.Status200OK)]
    [ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(ProblemDetails))]
    [ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ProblemDetails))]
    [AccessKey(SecurityAccess.DeleteWorkflowTemplate)]
    public async Task<IActionResult> DeactivateUser(
        [FromBody] EmailAddress email,
        CancellationToken cancellationToken = default!
    )
    {
        throw new NotImplementedException();
    }
}