You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
API/src/Entities/AthleteEntity.cs

114 lines
3.9 KiB

//-----------------------------------------------------------------------
// FILENAME: AthleteEntity.cs
// PROJECT: Entities
// SOLUTION: HeartTrack
// DATE CREATED: 22/02/2024
// AUTHOR: Antoine PEREDERII
//-----------------------------------------------------------------------
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.AspNetCore.Identity;
namespace Entities
{
/// <summary>
/// Represents an athlete entity in the database.
/// </summary>
[Table("Athlete")]
public class AthleteEntity
{
public AthleteEntity() : base() { }
/// <summary>
/// Gets or sets the unique identifier of the athlete.
/// </summary>
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdAthlete { get; set; }
/// <summary>
/// Gets or sets the username of the athlete.
/// </summary>
[MaxLength(100)]
[Required(ErrorMessage = "Athlete Username is ")]
public required string Username { get; set; }
/// <summary>
/// Gets or sets the last name of the athlete.
/// </summary>
[MaxLength(100)]
[Required(ErrorMessage = "Athlete Last Name is ")]
public required string LastName { get; set; }
/// <summary>
/// Gets or sets the first name of the athlete.
/// </summary>
[MaxLength(150)]
[Required(ErrorMessage = "Athlete First Name is ")]
public required string FirstName { get; set; }
/// <summary>
/// Gets or sets the email of the athlete.
/// </summary>
[MaxLength(100)]
[Required(ErrorMessage = "Athlete Email is ")]
public required string Email { get; set; }
/// <summary>
/// Gets or sets the gender of the athlete.
/// </summary>
[MaxLength(1)]
[Required(ErrorMessage = "Athlete Sexe is ")]
public required string Sexe { get; set; }
/// <summary>
/// Gets or sets the height of the athlete.
/// </summary>
public double Length { get; set; }
/// <summary>
/// Gets or sets the weight of the athlete.
/// </summary>
public float Weight { get; set; }
/// <summary>
/// Gets or sets the password of the athlete.
/// </summary>
[Required(ErrorMessage = "Athlete Password is ")]
public required string Password { get; set; }
/// <summary>
/// Gets or sets the date of birth of the athlete.
/// </summary>
[Required(ErrorMessage = "Athlete Date of Birth is ")]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
public DateOnly DateOfBirth { get; set; }
/// <summary>
/// Gets or sets whether the athlete is a coach.
/// </summary>
public bool IsCoach { get; set; }
public byte[] ProfilPicture { get; set; }
public ICollection<ActivityEntity> Activities { get; set; } = new List<ActivityEntity>();
public ICollection<StatisticEntity> Statistics { get; set; } = new List<StatisticEntity>();
public ICollection<TrainingEntity> TrainingsAthlete { get; set; } = new List<TrainingEntity>();
public ICollection<TrainingEntity> TrainingsCoach { get; set; } = new List<TrainingEntity>();
public ICollection<NotificationEntity> NotificationsReceived { get; set; } = new List<NotificationEntity>();
public ICollection<NotificationEntity> NotificationsSent { get; set; } = new List<NotificationEntity>();
public int? DataSourceId { get; set; }
public DataSourceEntity? DataSource { get; set; }
public ICollection<FriendshipEntity> Followers { get; set; } = [];
public ICollection<FriendshipEntity> Followings { get; set; } = [];
}
}