using Books.Api.Domain.BankConnections;

namespace Books.Api.EventFlow.ReadModels;

public class BankConnectionReadModelDto
{
    public string Id { get; set; } = string.Empty;
    public string CompanyId { get; set; } = string.Empty;
    public string AspspName { get; set; } = string.Empty;
    public string Status { get; set; } = string.Empty;
    public string? SessionId { get; set; }
    public DateTimeOffset? ValidUntil { get; set; }
    public List<BankAccountInfo>? Accounts { get; set; }
    public string? FailureReason { get; set; }
    public DateTimeOffset CreatedAt { get; set; }
    public DateTimeOffset UpdatedAt { get; set; }
    public bool IsArchived { get; set; }

    public bool IsActive => Status == "established" && ValidUntil > DateTimeOffset.UtcNow;
}
