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.TaskEntities
{
    [Table("Errors", Schema = DatabaseSchemas.Task)]
    [Comment("Таблица ошибок заданий")]
    public class TaskError : IBaseEntity
    {
        [Key]
        public Guid Id { get; set; }

        public DateTimeOffset DateCreated { get; set; }

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

        public Guid TaskId { get; set; }

        public int AttemptNumber { get; set; }

        public required string ErrorMessage { get; set; }

        public string? StackTrace { get; set; }

        [ForeignKey(nameof(TaskId))]
        public TaskItem? TaskItem { get; set; }
    }
}
