using FlatRender.ContentSvc.Application.Services;
using FlatRender.ContentSvc.Models.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace FlatRender.ContentSvc.Controllers;

/// <summary>Duplicate a project to another aspect ratio (same scene/element structure, new size).</summary>
[ApiController]
[Route("v1/projects")]
public class ProjectDuplicateController(TemplateService svc) : ControllerBase
{
    [Authorize(Roles = "Admin")]
    [HttpPost("{id:guid}/duplicate")]
    public async Task<IActionResult> Duplicate(Guid id, [FromBody] DuplicateProjectRequest req)
        => Ok(await svc.DuplicateProjectAsync(id, req ?? new DuplicateProjectRequest(null, null, null, null, null, null)));
}
