import { Component, Input } from '@angular/core';
import { DashboardStats } from '@red/domain';
import { IconButtonComponent, IconButtonTypes } from '@iqser/common-ui';
import { TranslateChartService } from '@services/translate-chart.service';
import { SharedDialogService } from '@shared/services/dialog.service';
import { Roles } from '@users/roles';
import { PermissionsService } from '@services/permissions.service';
import { NgIf } from '@angular/common';
import { RouterLink } from '@angular/router';
import { MatIcon } from '@angular/material/icon';
import { TranslateModule } from '@ngx-translate/core';
import { DonutChartComponent } from '@shared/components/donut-chart/donut-chart.component';
import { SnakeCasePipe } from '@common-ui/pipes/snake-case.pipe';

@Component({
    selector: 'redaction-template-stats [stats]',
    templateUrl: './template-stats.component.html',
    styleUrls: ['./template-stats.component.scss'],
    standalone: true,
    imports: [NgIf, RouterLink, MatIcon, TranslateModule, DonutChartComponent, IconButtonComponent, SnakeCasePipe],
})
export class TemplateStatsComponent {
    readonly iconButtonTypes = IconButtonTypes;
    readonly roles = Roles;

    @Input() stats: DashboardStats;

    constructor(
        private readonly _dialogService: SharedDialogService,
        readonly translateChartService: TranslateChartService,
        readonly permissionsService: PermissionsService,
    ) {}

    newDossier(): void {
        this._dialogService.openDialog('addDossier', { dossierTemplateId: this.stats.dossierTemplateId });
    }
}
