mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 09:26:52 +01:00
Adds the interfaces knowledge domain covering AL interfaces and enum-with-implementation: three atomic articles with good/bad AL samples, a new al-interfaces-review leaf skill, and additive wiring into al-code-review and the README. Purely additive; no contract change. Part of #34. Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
49 lines
1.2 KiB
AL
49 lines
1.2 KiB
AL
interface INotifier
|
|
{
|
|
procedure Send(Recipient: Text; Body: Text): Boolean;
|
|
}
|
|
|
|
codeunit 50206 "Email Notifier" implements INotifier
|
|
{
|
|
procedure Send(Recipient: Text; Body: Text): Boolean
|
|
begin
|
|
// A real implementation would hand the message to an email service.
|
|
exit(Recipient <> '');
|
|
end;
|
|
}
|
|
|
|
codeunit 50207 "Default Notifier" implements INotifier
|
|
{
|
|
procedure Send(Recipient: Text; Body: Text): Boolean
|
|
begin
|
|
// Safe fallback so an unmapped or future channel still resolves to a
|
|
// usable object instead of failing where the interface is called.
|
|
exit(false);
|
|
end;
|
|
}
|
|
|
|
enum 50208 "Notification Channel" implements INotifier
|
|
{
|
|
Extensible = true;
|
|
DefaultImplementation = INotifier = "Default Notifier";
|
|
|
|
value(0; Email)
|
|
{
|
|
Implementation = INotifier = "Email Notifier";
|
|
}
|
|
value(1; None)
|
|
{
|
|
// No explicit Implementation: resolves to DefaultImplementation above.
|
|
}
|
|
}
|
|
|
|
codeunit 50209 "Notification Dispatch"
|
|
{
|
|
procedure Notify(Channel: Enum "Notification Channel"; Recipient: Text; Body: Text): Boolean
|
|
var
|
|
Notifier: Interface INotifier;
|
|
begin
|
|
Notifier := Channel;
|
|
exit(Notifier.Send(Recipient, Body));
|
|
end;
|
|
}
|