using System.ComponentModel.DataAnnotations;

namespace Core.Entities;

public class EventDefinition
{
	public int Id { get; set; }

    [Required]
    [StringLength(100, MinimumLength = 2)]
    [Display(Name = "Event Name")]
    public string Name { get; set; }

    [Required]
    [StringLength(40, MinimumLength = 2)]
    [Display(Name = "Event Short Name")]
    public string? ShortName { get; set; }

    [Required]
    public EventFormat EventFormat { get; set; }
    
    [Range(1, 6)]
    public int MinTeamSize { get; set; }

    [Range(1, 6)]
    public int MaxTeamSize { get; set; }

	public string TeamSize =>
		MinTeamSize == MaxTeamSize
			? MinTeamSize.ToString()
			: $"{MinTeamSize.ToString()}-{MaxTeamSize.ToString()}";

    [StringLength(100, MinimumLength = 3)]
	public string? SemifinalistActivity { get; set; }

	public bool InterviewOrPresentation
		=> SemifinalistActivity != null && (SemifinalistActivity.Contains("Interview") || SemifinalistActivity.Contains("Presentation"));

	public bool OnSiteActivity { get; set; }
    //=> SemifinalistActivity != null
    //         && (SemifinalistActivity.Contains("Challenge")
    //          || SemifinalistActivity.Contains("Race")
    //          || SemifinalistActivity.Contains("Speech")
    //          || SemifinalistActivity.Contains("Test")
    //          || SemifinalistActivity.Contains("Flight")
    //          || Name.Contains("Leadership")
    //          || Name.Contains("Forensic")
    //          || Name.Contains("Flight")
    //          || Name.Contains("Coding")
    //          || SemifinalistActivity.Contains("Debate")
    //          || SemifinalistActivity.Contains("Photography")
    //          || SemifinalistActivity.Contains("Build")
    //          || Name.Contains("Chapter")
    //          || Name.Contains("Podcast"));

    [StringLength(1024, MinimumLength = 3)]
	public string? Notes { get; set; }

    [Range(0, 3)]
    public int ChapterEligibilityCountRegionals { get; set; }

    [Range(1, 3)]
    public int ChapterEligibilityCountState { get; set; }

    public bool RegionalEvent => ChapterEligibilityCountRegionals > 0;

	public bool Presubmission { get; set; }


    [StringLength(64)]
    public string? Documentation { get; set; }

    [Required]
    [StringLength(256)]
    public string Eligibility { get; set; }
    [StringLength(4096)]
	public string? Theme { get; set; }
    [StringLength(1024)]
    public string? Description { get; set; }
	public int? LevelOfEffort { get; set; }

	public override string ToString()
	{
		return Name;
	}

	public static readonly EventDefinition GeneralSchedule = new(){Name = "General Schedule"};
	public static readonly EventDefinition VotingDelegates = new(){Name = "Voting Delegates"};

}