import { Injectable } from '@angular/core';
import { GenericService } from '@iqser/common-ui';
import { ISmtpConfiguration } from '@red/domain';

@Injectable()
export class SmtpConfigService extends GenericService<unknown> {
    protected readonly _defaultModelPath = 'configuration';
    protected readonly _serviceName: string = 'tenant-user-management';

    updateSMTPConfiguration(body: ISmtpConfiguration) {
        return this._post(body, `${this._defaultModelPath}/smtp`);
    }

    testSMTPConfiguration(body: ISmtpConfiguration) {
        return this._post(body, `${this._defaultModelPath}/smtp/test`);
    }

    getCurrentSMTPConfiguration() {
        return this._getOne(['smtp']);
    }
}
