using CashLineERP.SharedKernel.IslamicFinance;

namespace CashLineERP.Domain.IslamicFinance.Shariah;

public sealed class IslamicFinanceShariahReviewRequirement
{
    public long ProductProfileId { get; }
    public long? FinancingRequestId { get; }
    public IslamicFinanceGovernanceReasonCode ReviewReason { get; }

    public IslamicFinanceShariahReviewRequirement(
        long productProfileId,
        long? financingRequestId,
        IslamicFinanceGovernanceReasonCode reviewReason)
    {
        if (productProfileId <= 0)
        {
            throw new InvalidOperationException("Islamic Finance Shariah review requires a valid product profile identifier.");
        }

        if (financingRequestId.HasValue && financingRequestId.Value <= 0)
        {
            throw new InvalidOperationException("Islamic Finance Shariah review financing request identifier must be a valid positive identifier when provided.");
        }

        ProductProfileId = productProfileId;
        FinancingRequestId = financingRequestId;
        ReviewReason = reviewReason;
    }
}
