2026-02-13 11:05:57 -06:00
|
|
|
namespace FiscalOS.API.Accounts.Add;
|
|
|
|
|
|
|
|
|
|
public record Request : IValidatableObject
|
|
|
|
|
{
|
|
|
|
|
public string PlaidInstitutionId { get; init; } = string.Empty;
|
|
|
|
|
public string PlaidAccountId { get; init; } = string.Empty;
|
2026-02-13 12:05:01 -06:00
|
|
|
public string PlaidAccountName { get; init; } = string.Empty;
|
2026-02-14 05:54:12 -06:00
|
|
|
public decimal AccountCurrentBalance { get; init; }
|
|
|
|
|
public decimal AccountAvailableBalance { get; init; }
|
2026-02-13 11:05:57 -06:00
|
|
|
|
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(PlaidInstitutionId))
|
|
|
|
|
{
|
|
|
|
|
var fieldName = nameof(PlaidInstitutionId);
|
|
|
|
|
yield return new($"The {fieldName} field is required.", [fieldName]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(PlaidAccountId))
|
|
|
|
|
{
|
|
|
|
|
var fieldName = nameof(PlaidAccountId);
|
|
|
|
|
yield return new($"The {fieldName} field is required.", [fieldName]);
|
|
|
|
|
}
|
2026-02-13 12:05:01 -06:00
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(PlaidAccountName))
|
|
|
|
|
{
|
|
|
|
|
var fieldName = nameof(PlaidAccountName);
|
|
|
|
|
yield return new($"The {fieldName} field is required.", [fieldName]);
|
|
|
|
|
}
|
2026-02-13 11:05:57 -06:00
|
|
|
}
|
|
|
|
|
}
|