using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace ms_lesService.Database.Models;

[Table("les")]
[Index(nameof(Les.Identifier), IsUnique = true)]
public class Les
{
    [Column("id_les")]
    [Key]
    public int Identifier { get; set; }
    
    [Column("id_parent_les")]
    [ForeignKey("id_parent_les")]
    public Les? Parent { get; set; } 
    
    [Column("id_les_type")] 
    [ForeignKey("id_les_type")]
    public LesType LesType { get; set; }

    public virtual ICollection<Entity>? Objects { get; set; } = new List<Entity>();
}