using System.ComponentModel.DataAnnotations;
using RacePlannerApi.Models;

namespace RacePlannerApi.DTOs;

public class CreatePaymentRequest
{
    [Required]
    public Guid RegistrationId { get; set; }

    [Required]
    [Range(0.01, double.MaxValue)]
    public decimal Amount { get; set; }

    [Required]
    public PaymentMethod Method { get; set; }

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

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

    public DateTime? PaymentDate { get; set; }
}

public class PaymentDto
{
    public Guid Id { get; set; }
    public Guid RegistrationId { get; set; }
    public decimal Amount { get; set; }
    public string Method { get; set; } = string.Empty;
    public string? TransactionId { get; set; }
    public string? Notes { get; set; }
    public DateTime PaymentDate { get; set; }
    public DateTime CreatedAt { get; set; }
}

public class PaymentReportDto
{
    public Guid EventId { get; set; }
    public string EventName { get; set; } = string.Empty;
    public decimal TotalCollected { get; set; }
    public decimal TotalPending { get; set; }
    public decimal TotalOutstanding { get; set; }
    public int TotalRegistrations { get; set; }
    public int PaidRegistrations { get; set; }
    public int PartialRegistrations { get; set; }
    public int UnpaidRegistrations { get; set; }
    public List<RegistrationPaymentDto> Registrations { get; set; } = new();
}

public class RegistrationPaymentDto
{
    public Guid RegistrationId { get; set; }
    public string ParticipantName { get; set; } = string.Empty;
    public string Status { get; set; } = string.Empty;
    public decimal TotalPaid { get; set; }
    public decimal AmountDue { get; set; }
    public string PaymentStatus { get; set; } = string.Empty;
    public List<PaymentDto> Payments { get; set; } = new();
}