namespace WebApi.Test.Repository;

public class TransactionTestBase : RepositoryTestBase
{
    protected TransactionRecord CreateTestRecord(
        decimal amount,
        TransactionType type = TransactionType.Expense,
        DateTime? occurredAt = null,
        string reason = "测试摘要",
        string classify = "测试分类")
    {
        return new TransactionRecord
        {
            Amount = amount,
            Type = type,
            OccurredAt = occurredAt ?? DateTime.Now,
            Reason = reason,
            Classify = classify,
            Card = "1234",
            Balance = 1000,
            EmailMessageId = 1,
            ImportNo = Guid.NewGuid().ToString(),
            ImportFrom = "测试"
        };
    }

    protected TransactionRecord CreateExpense(decimal amount, DateTime? occurredAt = null, string reason = "支出", string classify = "餐饮")
    {
        return CreateTestRecord(-amount, TransactionType.Expense, occurredAt, reason, classify);
    }

    protected TransactionRecord CreateIncome(decimal amount, DateTime? occurredAt = null, string reason = "收入", string classify = "工资")
    {
        return CreateTestRecord(amount, TransactionType.Income, occurredAt, reason, classify);
    }
}
