using System.ComponentModel.DataAnnotations;

namespace LibraryAPI.DTOs
{
    // ── Author DTOs ──────────────────────────────────────────────────────────

    public class AuthorDto
    {
        public int Id { get; set; }
        public string FirstName { get; set; } = string.Empty;
        public string LastName { get; set; } = string.Empty;
        public string FullName => $"{FirstName} {LastName}";
        public string? Biography { get; set; }
        public string? Nationality { get; set; }
        public DateTime CreatedAt { get; set; }
        public int BookCount { get; set; }
    }

    public class AuthorCreateDto
    {
        [Required]
        [MaxLength(100)]
        public string FirstName { get; set; } = string.Empty;

        [Required]
        [MaxLength(100)]
        public string LastName { get; set; } = string.Empty;

        [MaxLength(500)]
        public string? Biography { get; set; }

        [MaxLength(100)]
        public string? Nationality { get; set; }
    }

    public class AuthorUpdateDto
    {
        [Required]
        [MaxLength(100)]
        public string FirstName { get; set; } = string.Empty;

        [Required]
        [MaxLength(100)]
        public string LastName { get; set; } = string.Empty;

        [MaxLength(500)]
        public string? Biography { get; set; }

        [MaxLength(100)]
        public string? Nationality { get; set; }
    }

    // ── Complex: Top Borrowed Authors ────────────────────────────────────────

    public class TopBorrowedAuthorDto
    {
        public int AuthorId { get; set; }
        public string FullName { get; set; } = string.Empty;
        public string? Nationality { get; set; }
        public int TotalBorrows { get; set; }
        public int UniqueBooks { get; set; }
        public DateTime? LastBorrowDate { get; set; }
    }
}
