using System.ComponentModel.DataAnnotations;

namespace GerbilManagerWebAPI.Models
{
    /// <summary>A tank/cage (Becken) that gerbils currently live in.</summary>
    public class Enclosure
    {
        [Key]
        public Guid Id { get; set; }
        public required string Name { get; set; }
        public string? Notes { get; set; }

        // Reinigungszyklus (aus RennmausPro becken_tb: _SIZE/_MENGE/_CLEANED/_CYCLUS).
        /// <summary>Maße als Freitext (z. B. "120×50 cm").</summary>
        public string? Size { get; set; }
        /// <summary>Empfohlene/maximale Tieranzahl.</summary>
        public int? Capacity { get; set; }
        /// <summary>Datum der letzten Reinigung.</summary>
        public DateOnly? LastCleanedDate { get; set; }
        /// <summary>Reinigungsintervall in Tagen.</summary>
        public int? CleaningCycleDays { get; set; }

        /// <summary>Nächste fällige Reinigung = LastCleanedDate + CleaningCycleDays (berechnet, nicht persistiert).</summary>
        public DateOnly? NextCleaningDate =>
            LastCleanedDate is { } last && CleaningCycleDays is { } cycle and > 0
                ? last.AddDays(cycle)
                : null;

        public ICollection<Gerbil> Gerbils { get; } = new List<Gerbil>();
    }
}
