generated from ricardo/MVCLogin
63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SumaTube.Domain.Entities.Videos
|
|
{
|
|
public class VideoSummary
|
|
{
|
|
public string Id { get; private set; }
|
|
public string VideoId { get; private set; }
|
|
public string Title { get; private set; }
|
|
public string ThumbnailUrl { get; private set; }
|
|
public string Status { get; private set; }
|
|
public DateTime RequestDate { get; private set; }
|
|
public string Language { get; private set; }
|
|
public string UserId { get; private set; }
|
|
public string Summary { get; private set; }
|
|
public string Transcription { get; private set; }
|
|
public int Duration { get; private set; }
|
|
public string ErrorMessage { get; private set; }
|
|
public string SessionId { get; private set; }
|
|
|
|
// Factory method
|
|
public static VideoSummary Create(string videoId, string userId, string language, string sessionId)
|
|
{
|
|
return new VideoSummary
|
|
{
|
|
Id = Guid.NewGuid().ToString(),
|
|
VideoId = videoId,
|
|
Title = "Carregando...",
|
|
ThumbnailUrl = $"https://img.youtube.com/vi/{videoId}/maxresdefault.jpg",
|
|
Status = "PROCESSANDO",
|
|
RequestDate = DateTime.UtcNow,
|
|
Language = language,
|
|
UserId = userId,
|
|
SessionId = sessionId
|
|
};
|
|
}
|
|
|
|
// Methods to update state
|
|
public void SetAsCompleted(string title, string summary, string transcription, int duration)
|
|
{
|
|
Title = title;
|
|
Summary = summary;
|
|
Transcription = transcription;
|
|
Duration = duration;
|
|
Status = "REALIZADO";
|
|
ErrorMessage = null;
|
|
}
|
|
|
|
public void SetAsFailed(string errorMessage)
|
|
{
|
|
Status = "ERRO";
|
|
ErrorMessage = errorMessage;
|
|
}
|
|
|
|
// For MongoDB/ORM
|
|
private VideoSummary() { }
|
|
}
|
|
}
|