namespace ladaexpress.vn.Infrastructures.Services
{
    /// <summary>
    /// Service để tạo và quản lý robots.txt
    /// </summary>
    public interface IRobotsService
    {
        /// <summary>
        /// Tạo nội dung robots.txt
        /// </summary>
        /// <returns>Nội dung robots.txt</returns>
        Task<string> GenerateRobotsTxtAsync();

        /// <summary>
        /// Tạo robots.txt cho development environment
        /// </summary>
        /// <returns>Nội dung robots.txt cho dev</returns>
        Task<string> GenerateDevRobotsTxtAsync();

        /// <summary>
        /// Tạo robots.txt cho production environment
        /// </summary>
        /// <returns>Nội dung robots.txt cho production</returns>
        Task<string> GenerateProdRobotsTxtAsync();

        /// <summary>
        /// Validate robots.txt syntax
        /// </summary>
        /// <param name="robotsTxt">Nội dung robots.txt</param>
        /// <returns>Danh sách lỗi</returns>
        List<string> ValidateRobotsTxt(string robotsTxt);

        /// <summary>
        /// Lưu robots.txt vào file
        /// </summary>
        /// <param name="robotsTxt">Nội dung</param>
        /// <returns>Đường dẫn file</returns>
        Task<string> SaveRobotsTxtAsync(string robotsTxt);

        /// <summary>
        /// Get robots.txt recommendations
        /// </summary>
        /// <returns>Danh sách gợi ý</returns>
        Task<List<string>> GetRobotsRecommendationsAsync();
    }

    /// <summary>
    /// Model cho robots rule
    /// </summary>
    public class RobotsRule
    {
        public string UserAgent { get; set; } = "*";
        public List<string> Allow { get; set; } = new List<string>();
        public List<string> Disallow { get; set; } = new List<string>();
        public int? CrawlDelay { get; set; }
        public string? Sitemap { get; set; }
        public Dictionary<string, string> Extensions { get; set; } = new Dictionary<string, string>();
    }
}