using System.Text.Json;

namespace TornadoAce_CJOnStyle.Domain
{
    public sealed record SceneTemplateDefinition(
        string TemplateId,
        string TemplateName,
        string TornadoVersion,
        IReadOnlyList<FieldMappingDefinition> Mappings);

    public sealed record FieldMappingDefinition(
        string CueSheetField,
        string SceneObjectName,
        string Attribute,
        string Rule);

    public sealed record SceneDataSnapshot(
        string SceneName,
        string TemplateId,
        IReadOnlyDictionary<string, string> VisibleTextObjects,
        IReadOnlyList<string> ImagePaths)
    {
        public string ToPreviewJson()
        {
            var payload = new
            {
                scene = SceneName,
                templateId = TemplateId,
                text = VisibleTextObjects,
                images = ImagePaths
            };

            return JsonSerializer.Serialize(payload, new JsonSerializerOptions { WriteIndented = true });
        }
    }
}
