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

namespace RobotNet.MapManager.Data;

#nullable disable

[Table("ElementModels")]
[Index(nameof(MapId), nameof(Name), Name = "IX_ElementModel_MapId_Name")]
public class ElementModel
{
    [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("Width", TypeName = "float")]
    [Required]
    public double Width { get; set; }

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

    [Column("Image1Width", TypeName = "int")]
    [Required]
    public int Image1Width { get; set; }

    [Column("Image1Height", TypeName = "int")]
    [Required]
    public int Image1Height { get; set; }

    [Column("Image2Width", TypeName = "int")]
    [Required]
    public int Image2Width { get; set; }

    [Column("Image2Height", TypeName = "int")]
    [Required]
    public int Image2Height { get; set; }

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

    public virtual ICollection<Element> Elements { get; } = [];
    public Map Map { get; set; }
}
