using Microsoft.EntityFrameworkCore;
using RobotNet.MapShares.Enums;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace RobotNet.MapManager.Data;

#nullable disable

[Table("Edges")]
[Index(nameof(MapId), Name = "IX_Edge_MapId")]
public class Edge
{
    [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("StartNodeId", TypeName = "uniqueidentifier")]
    [Required]
    public Guid StartNodeId { get; set; }

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

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

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

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

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

    [Column("TrajectoryDegree", TypeName = "tinyint")]
    public TrajectoryDegree TrajectoryDegree { get; set; }

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

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

    [Column("DirectionAllowed", TypeName = "tinyint")]
    public DirectionAllowed DirectionAllowed { get; set; }

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

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

    [Column("MaxSpeed", TypeName = "float")]
    public double MaxSpeed { 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 virtual Node StartNode { get; set; }
    public virtual Node EndNode { get; set; }
}
