using System.Collections.Generic;
using EventsAppQuest.Application.Services;
using EventsAppQuest.Domain.Models;

namespace EventsAppQuest.Infrastructure.Services
{
    /// <summary>
    /// Implementacao mock do servico de templates de eventos para desenvolvimento local.
    /// </summary>
    public class MockTemplateService : ITemplateService
    {
        private readonly List<EventTemplate> _templates = new List<EventTemplate>
        {
            new EventTemplate
            {
                Id = "tpl-1",
                Name = "Aniversário Infantil",
                Description = "Template para festa infantil.",
                EventCategoryId = "cat-birthday",
                SupplierId = "supplier-1"
            },
            new EventTemplate
            {
                Id = "tpl-2",
                Name = "Casamento Clássico",
                Description = "Template para cerimônia e recepção.",
                EventCategoryId = "cat-wedding",
                SupplierId = "supplier-1"
            },
            new EventTemplate
            {
                Id = "tpl-3",
                Name = "Evento Corporativo",
                Description = "Template para reuniões e convenções.",
                EventCategoryId = "cat-business",
                SupplierId = "supplier-2"
            }
        };

        public IReadOnlyList<EventTemplate> GetAll() => _templates;

        public EventTemplate GetById(string id) => _templates.Find(t => t.Id == id);

        public IReadOnlyList<EventTemplate> GetByCategoryId(string categoryId)
        {
            if (string.IsNullOrEmpty(categoryId)) return _templates;
            var list = new List<EventTemplate>();
            foreach (var t in _templates)
                if (t.EventCategoryId == categoryId)
                    list.Add(t);
            return list;
        }
    }
}
