2026-02-13 11:05:57 -06:00
|
|
|
namespace FiscalOS.API.Accounts.Add;
|
|
|
|
|
|
|
|
|
|
public record Request : IValidatableObject
|
|
|
|
|
{
|
2026-03-11 10:51:28 -05:00
|
|
|
public string ProviderInstitutionId { get; init; } = string.Empty;
|
|
|
|
|
public string ProviderAccountId { get; init; } = string.Empty;
|
|
|
|
|
public string ProviderAccountName { get; init; } = string.Empty;
|
2026-02-13 11:05:57 -06:00
|
|
|
|
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
|
|
|
{
|
2026-03-11 10:51:28 -05:00
|
|
|
if (string.IsNullOrWhiteSpace(ProviderInstitutionId))
|
2026-02-13 11:05:57 -06:00
|
|
|
{
|
2026-03-11 10:51:28 -05:00
|
|
|
var fieldName = nameof(ProviderInstitutionId);
|
2026-02-13 11:05:57 -06:00
|
|
|
yield return new($"The {fieldName} field is required.", [fieldName]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-11 10:51:28 -05:00
|
|
|
if (string.IsNullOrWhiteSpace(ProviderAccountId))
|
2026-02-13 11:05:57 -06:00
|
|
|
{
|
2026-03-11 10:51:28 -05:00
|
|
|
var fieldName = nameof(ProviderAccountId);
|
2026-02-13 11:05:57 -06:00
|
|
|
yield return new($"The {fieldName} field is required.", [fieldName]);
|
|
|
|
|
}
|
2026-02-13 12:05:01 -06:00
|
|
|
|
2026-03-11 10:51:28 -05:00
|
|
|
if (string.IsNullOrWhiteSpace(ProviderAccountName))
|
2026-02-13 12:05:01 -06:00
|
|
|
{
|
2026-03-11 10:51:28 -05:00
|
|
|
var fieldName = nameof(ProviderAccountName);
|
2026-02-13 12:05:01 -06:00
|
|
|
yield return new($"The {fieldName} field is required.", [fieldName]);
|
|
|
|
|
}
|
2026-02-13 11:05:57 -06:00
|
|
|
}
|
|
|
|
|
}
|