using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace RacePlannerApi.Models;

public class Event
{
    [Key]
    public Guid Id { get; set; } = Guid.NewGuid();

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

    [MaxLength(2000)]
    public string Description { get; set; } = string.Empty;

    [Required]
    public DateTime EventDate { get; set; }

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

    public EventStatus Status { get; set; } = EventStatus.Draft;

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

    public List<string> Tags { get; set; } = new List<string>();

    public int? MaxParticipants { get; set; }

    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

    // Foreign keys
    [Required]
    public Guid OrganizerId { get; set; }

    [ForeignKey("OrganizerId")]
    public User Organizer { get; set; } = null!;

    // Navigation properties
    public ICollection<Registration> Registrations { get; set; } = new List<Registration>();
    public ICollection<Announcement> Announcements { get; set; } = new List<Announcement>();
}

public enum EventStatus
{
    Draft,
    Published,
    Cancelled,
    Completed
}