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

namespace RobotNet.MapManager.Data;

#nullable disable

[Table("Elements")]
[Index(nameof(MapId), nameof(ModelId), Name = "IX_Element_MapId_ModelId")]
public class Element
{
    [Column("Id", TypeName = "uniqueidentifier")]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    [Key]
    [Required]
    public Guid Id { get; set; }

    [Column("MapId", TypeName = "uniqueidentifier")]
    [Required]
    public Guid MapId { get; set; }

    [Column("ModelId", TypeName = "uniqueidentifier")]
    [Required]
    public Guid ModelId { get; set; }

    [Column("NodeId", TypeName = "uniqueidentifier")]
    [Required]
    public Guid NodeId { get; set; }

    [Column("Name", TypeName = "nvarchar(64)")]
    public string Name { get; set; }

    [Column("IsOpen", TypeName = "bit")]
    public bool IsOpen { get; set; }

    [Column("OffsetX", TypeName = "float")]
    public double OffsetX { get; set; }

    [Column("OffsetY", TypeName = "float")]
    public double OffsetY { get; set; }

    [Column("Content", TypeName = "nvarchar(max)")]
    public string Content { get; set; }

    public Map Map { get; set; }
    public ElementModel Model { get; set; }
    public Node Node { get; set; }
}
