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

namespace ms_useCaseService.Database.Models;

[Table("objects")]
[Index(nameof(Entity.Identifier), IsUnique = true)]
public class Entity
{
    [Column("id_object")]
    [Key]
    public int Identifier { get; set; }
    
    [Column("id_parent_object")]
    [ForeignKey("id_parent_object")]
    public Entity? Parent { get; set; }
    
    public virtual ICollection<FrameworkMetadataType> FrameworkMetadataTypes { get; set; } = new List<FrameworkMetadataType>();
    public virtual ICollection<Les> Leses { get; set; } = new List<Les>();
    public virtual ICollection<ObjectMetadataType> ObjectMetadataTypes { get; set; } = new List<ObjectMetadataType>();
}