using e_suite.Database.Audit.Attributes;
using e_suite.Database.Core.Models;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace e_suite.Database.Core.Tables.Printer
{
    [DisplayName("Specification")]
    [Table("Specifications", Schema = "Printer")]
    [Index(nameof(Id), IsUnique = true)]
    [Index(nameof(Guid), IsUnique = true)]
    [Index(nameof(SigmaId), IsUnique = true)]
    public class Specification : IGeneralId, ISoftDeletable, IName
    {
        [Key]
        public long Id { get; set; }

        [Required]
        public Guid Guid { get; set; } = Guid.NewGuid();

        [AuditName]
        [Required]
        public string Name { get; set; } = string.Empty;

        public long FormInstanceId { get; set; }

        [AuditSoftDelete(true)]
        [Required]
        [DefaultValue(false)]
        public bool Deleted { get; set; } = false;

        [Required]
        public long SiteId { get; set; }

        [AuditLastUpdated]
        public DateTimeOffset LastUpdated { get; set; }

        [AuditParent]
        [Required]
        [ForeignKey(nameof(SiteId))]
        public virtual Site Site { get; set; } = null!;

        public long? SigmaId { get; set; } = null!;
    }
}
