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

namespace PARR.Domain.Entities.RobotEntities
{
    /// <summary>
    /// Снимки заданий роботам
    /// </summary>
    [Table("ConfigurationSnapshots", Schema = DatabaseSchemas.Robot)]
    [Index(nameof(RobotCode), nameof(DateCreated))]
    [Comment("Снимки заданий роботам")]
    public class RobotConfigurationSnapshot : IBaseEntity
    {
        [Key]
        public Guid Id { get; set; }

        public DateTimeOffset DateCreated { get; set; }

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

        public int RobotCode { get; set; }

        public int RobotStatusCode { get; set; }

        public int TaskStatusCode { get; set; }

        [Comment("Количество заданий в этой комбинации статусов")]
        public int Count { get; set; }


        [ForeignKey(nameof(RobotCode))]
        public Robot? Robot { get; set; }

        [ForeignKey(nameof(RobotStatusCode))]
        public RobotStatus? RobotStatus { get; set; }

        [ForeignKey(nameof(TaskStatusCode))]
        public TaskStatus? TaskStatus { get; set; }
    }
}
