Initial commit

This commit is contained in:
root
2025-12-21 09:55:58 -05:00
committed by Sebastian Krupinski
commit 169b7b4c91
57 changed files with 10105 additions and 0 deletions

62
src/models/provider.ts Normal file
View File

@@ -0,0 +1,62 @@
/**
* Class model for Provider Interface
*/
import type {
ProviderInterface,
ProviderCapabilitiesInterface
} from "@/types/provider";
export class ProviderObject implements ProviderInterface {
_data!: ProviderInterface;
constructor() {
this._data = {
'@type': 'mail.provider',
identifier: '',
label: '',
capabilities: {},
};
}
fromJson(data: ProviderInterface): ProviderObject {
this._data = data;
return this;
}
toJson(): ProviderInterface {
return this._data;
}
capable(capability: keyof ProviderCapabilitiesInterface): boolean {
const value = this._data.capabilities?.[capability];
return value !== undefined && value !== false;
}
capability(capability: keyof ProviderCapabilitiesInterface): any | null {
if (this._data.capabilities) {
return this._data.capabilities[capability];
}
return null;
}
/** Immutable Properties */
get '@type'(): string {
return this._data['@type'];
}
get identifier(): string {
return this._data.identifier;
}
get label(): string {
return this._data.label;
}
get capabilities(): ProviderCapabilitiesInterface {
return this._data.capabilities;
}
}