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

@Injectable()
export class RulesService extends GenericService<IRules> {
    protected readonly _defaultModelPath = 'rules';

    download(dossierTemplateId: string, ruleFileType: IRules['ruleFileType'] = 'ENTITY') {
        return this._getOne([dossierTemplateId, ruleFileType]);
    }

    uploadRules(body: IRules) {
        return this._post<unknown>({ ...body, ruleFileType: body.ruleFileType ?? 'ENTITY' });
    }
}
