import { Component } from '@angular/core';
import { BaseInputComponent } from 'first-npm-package-nicule/forms';
import { ControlContainer, NgForm } from '@angular/forms';

@Component({
    templateUrl: 'checkbox-field.component.html',
    styleUrls: ['../mat-field.scss', 'checkbox-field.component.scss'],
    viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
})
export class CheckboxFieldComponent extends BaseInputComponent {
    get rightLabel(): string {
        const rightLabelKey = this.labelingService.label(this.field.name, this.form.name, 'rightLabel');
        const translatedPlaceholder = this.translateService.instant(rightLabelKey);

        return rightLabelKey === translatedPlaceholder || translatedPlaceholder === 'rightLabel' ? '' : translatedPlaceholder;
    }
}
