Files
Geradores/GeradoresService/Core/GeneratorBase.cs
Marco Santos d7ea8a9b9e Reescrita dos geradores: biblioteca IGenerator, minimal API e novo frontend
- GeradoresService: cada tipo passa a ser um IGenerator (NIF, NIPC, NISS, CC,
  passaporte, IBAN, NIB, cartões, referência MB, pessoa, telefone, código postal,
  email, matrícula, EAN, UUID) registado em GeneratorRegistry; remove DAL/EF
- GeradoresWS: minimal APIs em /api/v1 com OpenAPI + Scalar e health check
- UnitTest: testes de ida e volta, valores conhecidos, detecção e API
- geradoresfe: UI construída a partir dos metadados da API, validador livre,
  exportação CSV/JSON/TXT, nginx com API_UPSTREAM configurável
- Docker, docker-compose e Jenkinsfile actualizados

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 23:51:39 +01:00

19 lines
795 B
C#

namespace GeradoresService.Core;
public abstract class GeneratorBase : IGenerator
{
public abstract string Id { get; }
public abstract string Name { get; }
public abstract string Category { get; }
public abstract string Description { get; }
public virtual IReadOnlyList<GeneratorOption> Options => [];
public virtual bool HasChecksum => true;
public virtual bool CanValidate => true;
public abstract GeneratedItem Generate(GeneratorContext context);
public abstract ValidationResult Validate(string value);
protected static GeneratorOption Option(string key, string label, string defaultValue, params (string Value, string Label)[] choices) =>
new(key, label, choices.Select(c => new OptionChoice(c.Value, c.Label)).ToArray(), defaultValue);
}