using Microsoft.AspNetCore.Mvc;
using RR3CommunityServer.Models;

namespace RR3CommunityServer.Controllers;

[ApiController]
[Route("director/api/android")]
public class DirectorController : ControllerBase
{
    private readonly ILogger<DirectorController> _logger;
    private readonly IConfiguration _configuration;

    public DirectorController(ILogger<DirectorController> logger, IConfiguration configuration)
    {
        _logger = logger;
        _configuration = configuration;
    }

    [HttpGet("getDirectionByPackage")]
    public ActionResult<SynergyResponse<DirectorResponse>> GetDirection([FromQuery] string packageName)
    {
        _logger.LogInformation("Director request for package: {Package}", packageName);

        var baseUrl = $"{Request.Scheme}://{Request.Host}";

        var response = new SynergyResponse<DirectorResponse>
        {
            resultCode = 0,
            message = "Success",
            data = new DirectorResponse
            {
                serverUrls = new Dictionary<string, string>
                {
                    { "synergy.product", baseUrl },
                    { "synergy.drm", baseUrl },
                    { "synergy.user", baseUrl },
                    { "synergy.tracking", baseUrl },
                    { "synergy.rewards", baseUrl },
                    { "synergy.progression", baseUrl },
                    { "synergy.content", baseUrl },  // Asset downloads
                    { "synergy.s2s", baseUrl },
                    { "nexus.portal", baseUrl },
                    { "ens.url", baseUrl }
                },
                environment = "COMMUNITY",
                version = "1.0.0"
            }
        };

        return Ok(response);
    }
}
