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

namespace RobotNet.MapManager.Data;

[Table("Zones")]
[Index(nameof(MapId), Name = "IX_Zone_MapId")]
public class Zone
{
    [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("Type", TypeName = "int")]
    [Required]
    public ZoneType Type { get; set; }

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

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

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

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

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

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

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

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

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

    public Map Map { get; set; } = default!;
}
