using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Unit;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace PARR.Domain.Entities.Job
{
    [Table("FieldFilters", Schema = DatabaseSchemas.Job)]
    [Comment("Таблица описания критериев выборки аттрибутов ЭК")]
    public class JobFieldFilter : IBaseEntity
    {
        [Key]
        public Guid Id { get; set; }

        public DateTimeOffset DateCreated { get; set; }

        [NotMapped]
        public DateTimeOffset? DateModified { get; set; }

        public Guid UnitFilterId { get; set; }

        public Guid FieldId { get; set; }

        public required string ValueMask { get; set; }

        /// <summary>
        /// Отсутствует
        /// </summary>
        public bool IsInverse { get; set; } = false;


        [ForeignKey(nameof(FieldId))]
        public UnitField? UnitField { get; set; }

        [ForeignKey(nameof(UnitFilterId))]
        public JobUnitFilter? UnitFilter { get; set; }
    }
}
