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

namespace RobotNet.MapManager.Data;

#nullable disable

[Table("Nodes")]
[Index(nameof(MapId), nameof(Name), Name = "IX_Node_MapId_Name")]
public class Node
{
    [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("Name", TypeName = "nvarchar(64)")]
    public string Name { get; set; }

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

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

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

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

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

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

    public Map Map { get; set; }
    public Element Element { get; set; }
    public ICollection<Edge> StartEdges { get; } = [];
    public ICollection<Edge> EndEdges { get; } = [];
}
