namespace OnlyOneAccessTemplate.Models
{
    public class AdSettings
    {
        public bool Enabled { get; set; } = true;
        public string PublisherID { get; set; } = "";
        public bool TestMode { get; set; } = false;
        public Dictionary<string, string> Slots { get; set; } = new();
        public AdDisplayRules DisplayRules { get; set; } = new();
    }

    public class AdDisplayRules
    {
        public int MaxAdsPerPage { get; set; } = 7;
        public int MaxAdsAboveFold { get; set; } = 3;
        public bool ShowOnMobile { get; set; } = true;
        public bool AllowStickyAds { get; set; } = true;
        public List<string> DisabledPositions { get; set; } = new();
    }

    public class AdPerformanceMetrics
    {
        public string Position { get; set; } = "";
        public int Impressions { get; set; }
        public int Clicks { get; set; }
        public double CTR => Impressions > 0 ? (double)Clicks / Impressions * 100 : 0;
        public decimal Revenue { get; set; }
        public decimal RPM => Impressions > 0 ? Revenue / Impressions * 1000 : 0;
        public DateTime LastUpdated { get; set; } = DateTime.UtcNow;
    }
}
