using System.ComponentModel.DataAnnotations.Schema;

namespace CashLineERP.Domain.IslamicFinance.Disbursements;

public sealed class IslamicFinanceMurabahaDisbursementExecution
{
    public string? ExecutionReferenceNumber { get; }
    public DateTime? ExecutedAtUtc { get; }
    public long? ExecutedByUserId { get; }
    public string? ExecutionNotes { get; }

    [NotMapped]
    public bool IsExecuted => ExecutedAtUtc.HasValue;

    public IslamicFinanceMurabahaDisbursementExecution(
        string? executionReferenceNumber,
        DateTime? executedAtUtc,
        long? executedByUserId,
        string? executionNotes)
    {
        ExecutionReferenceNumber = string.IsNullOrWhiteSpace(executionReferenceNumber)
            ? null
            : executionReferenceNumber.Trim().ToUpperInvariant();
        ExecutedAtUtc = executedAtUtc;
        ExecutedByUserId = executedByUserId;
        ExecutionNotes = string.IsNullOrWhiteSpace(executionNotes) ? null : executionNotes.Trim();
    }
}
