using System;
using API.DTOs.Scrobbling;
using API.Entities.Interfaces;
using API.Services;
namespace API.Entities.Scrobble;
#nullable enable
/// 
/// Represents an event that would need to be sent to the API layer. These rows will be processed and deleted.
/// 
public class ScrobbleEvent : IEntityDate
{
    public long Id { get; set; }
    public required ScrobbleEventType ScrobbleEventType { get; set; }
    public int? AniListId { get; set; }
    public long? MalId { get; set; }
    /// 
    /// Rating for the Series
    /// 
    public float? Rating { get; set; }
    /// 
    /// Review for the Series
    /// 
    public string? ReviewBody { get; set; }
    public string? ReviewTitle { get; set; }
    public required PlusMediaFormat Format { get; set; }
    /// 
    /// Depends on the ScrobbleEvent if filled in
    /// 
    public int? ChapterNumber { get; set; }
    /// 
    /// Depends on the ScrobbleEvent if filled in
    /// 
    public float? VolumeNumber { get; set; }
    /// 
    /// Has this event been processed and pushed to Provider
    /// 
    public bool IsProcessed { get; set; }
    /// 
    /// Was there an error processing this event
    /// 
    public bool IsErrored { get; set; }
    /// 
    /// The error details
    /// 
    public string? ErrorDetails { get; set; }
    /// 
    /// The date this was processed
    /// 
    public DateTime? ProcessDateUtc { get; set; }
    public required int SeriesId { get; set; }
    public Series Series { get; set; }
    public required int LibraryId { get; set; }
    public Library Library { get; set; }
    public AppUser AppUser { get; set; }
    public required int AppUserId { get; set; }
    public DateTime Created { get; set; }
    public DateTime LastModified { get; set; }
    public DateTime CreatedUtc { get; set; }
    public DateTime LastModifiedUtc { get; set; }
    /// 
    /// Sets the ErrorDetail and marks the event as 
    /// 
    /// 
    public void SetErrorMessage(string errorMessage)
    {
        ErrorDetails = errorMessage;
        IsErrored = true;
    }
}