using CashLineERP.Domain.Common;

namespace CashLineERP.Domain.Finance;

public sealed class ForeignExchangeRevaluationLine : Entity
{
    public long Id { get; private set; }
    public long ForeignExchangeRevaluationId { get; private set; }
    public int LineNumber { get; private set; }
    public string SourceTypeCode { get; private set; } = string.Empty;
    public long SourceDocumentId { get; private set; }
    public string SourceDocumentNumber { get; private set; } = string.Empty;
    public long SourceGeneralLedgerAccountId { get; private set; }
    public long? BranchId { get; private set; }
    public long? PartyId { get; private set; }
    public DateOnly SourceDocumentDate { get; private set; }
    public string CurrencyCode { get; private set; } = "USD";
    public decimal ForeignAmount { get; private set; }
    public decimal CarryingRateToBase { get; private set; }
    public decimal RevaluationRateToBase { get; private set; }
    public decimal CarryingBaseAmount { get; private set; }
    public decimal RevaluedBaseAmount { get; private set; }
    public decimal VarianceBaseAmount { get; private set; }

    public ForeignExchangeRevaluationLine(
        long foreignExchangeRevaluationId,
        int lineNumber,
        string sourceTypeCode,
        long sourceDocumentId,
        string sourceDocumentNumber,
        long sourceGeneralLedgerAccountId,
        long? branchId,
        long? partyId,
        DateOnly sourceDocumentDate,
        string currencyCode,
        decimal foreignAmount,
        decimal carryingRateToBase,
        decimal revaluationRateToBase,
        decimal carryingBaseAmount,
        decimal revaluedBaseAmount,
        decimal varianceBaseAmount)
    {
        ForeignExchangeRevaluationId = foreignExchangeRevaluationId;
        LineNumber = lineNumber;
        SourceTypeCode = sourceTypeCode;
        SourceDocumentId = sourceDocumentId;
        SourceDocumentNumber = sourceDocumentNumber;
        SourceGeneralLedgerAccountId = sourceGeneralLedgerAccountId;
        BranchId = branchId;
        PartyId = partyId;
        SourceDocumentDate = sourceDocumentDate;
        CurrencyCode = currencyCode;
        ForeignAmount = foreignAmount;
        CarryingRateToBase = carryingRateToBase;
        RevaluationRateToBase = revaluationRateToBase;
        CarryingBaseAmount = carryingBaseAmount;
        RevaluedBaseAmount = revaluedBaseAmount;
        VarianceBaseAmount = varianceBaseAmount;
    }

    private ForeignExchangeRevaluationLine()
    {
    }
}
