import { Repository } from 'typeorm';
import { PeriodStatus } from '../../common/enums/period-status.enum';
import { AuthenticatedUser } from '../../common/interfaces/authenticated-user.interface';
import { AuditLog } from '../audit/entities/audit-log.entity';
import { Attendance } from '../attendances/entities/attendance.entity';
import { CalculationsService } from '../calculations/calculations.service';
import { Company } from '../companies/entities/company.entity';
import { UserCompany } from '../companies/entities/user-company.entity';
import { Period } from '../periods/entities/period.entity';
import { Site } from '../sites/entities/site.entity';
import { UserSite } from '../sites/entities/user-site.entity';
import { User } from '../users/entities/user.entity';
import { WorkerSite } from '../workers/entities/worker-site.entity';
import { Worker } from '../workers/entities/worker.entity';
export interface SiteMonthCard {
    companyId: number;
    companyCode: string;
    companyName: string;
    siteId: number;
    siteCode: string;
    siteName: string;
    periodId: number | null;
    periodStatus: PeriodStatus | null;
    workersCount: number;
    daysWithAtLeastOneEntry: number;
    workingDays: number;
    totalRemuneration: number;
    totalAdvances: number;
    rejectionNote?: string | null;
}
export interface PeriodAlert {
    periodId: number;
    siteId: number;
    siteName: string;
    companyName: string;
    status: PeriodStatus;
    rejectionNote: string | null;
    submittedAt: Date | null;
}
export interface PeriodsByStatusCount {
    OPEN: number;
    SUBMITTED: number;
    VALIDATED: number;
    REJECTED: number;
}
export interface SiteWithoutRecentActivity {
    id: number;
    code: string;
    name: string;
    companyName: string;
    lastAttendanceDate: string | null;
}
export interface AdminDashboard {
    role: 'ADMIN';
    labelMonth: number;
    labelYear: number;
    usersByRole: Record<string, number>;
    activeUsers: number;
    activeCompanies: number;
    activeSites: number;
    lockedUsersCount: number;
    inactiveSitesCount: number;
    totalRemunerationMonth: number;
    totalRemunerationLastYear: number;
    periodsByStatus: PeriodsByStatusCount;
    pendingSubmittedPeriods: PeriodAlert[];
    recentAuditLogs: {
        id: number;
        userId: number;
        action: string;
        entityType: string;
        createdAt: Date;
    }[];
}
export interface ManagerDashboard {
    role: 'MANAGER';
    labelMonth: number;
    labelYear: number;
    cards: SiteMonthCard[];
    totalRemuneration: number;
    totalRemunerationLastYear: number;
    totalActiveWorkers: number;
    pendingValidations: number;
    topSites: SiteMonthCard[];
    rejectedPeriods: PeriodAlert[];
    sitesWithoutPeriod: {
        id: number;
        code: string;
        name: string;
        companyName: string;
    }[];
    sitesWithoutRecentAttendance: SiteWithoutRecentActivity[];
}
export interface SupervisorDashboard {
    role: 'SUPERVISOR';
    labelMonth: number;
    labelYear: number;
    cards: SiteMonthCard[];
    totalActiveWorkers: number;
    rejectedPeriods: PeriodAlert[];
}
export interface ViewerDashboard {
    role: 'VIEWER';
    labelMonth: number;
    labelYear: number;
    currents: SiteMonthCard[];
    totalRemunerationMonth: number;
    totalAdvancesMonth: number;
    validatedHistory: {
        periodId: number;
        siteId: number;
        siteName: string;
        labelMonth: number;
        labelYear: number;
        totalRemuneration: number;
        totalAdvances: number;
    }[];
}
export type DashboardResponse = AdminDashboard | ManagerDashboard | SupervisorDashboard | ViewerDashboard;
export declare class DashboardService {
    private readonly usersRepository;
    private readonly companiesRepository;
    private readonly userCompaniesRepository;
    private readonly sitesRepository;
    private readonly userSitesRepository;
    private readonly workersRepository;
    private readonly workerSitesRepository;
    private readonly periodsRepository;
    private readonly attendancesRepository;
    private readonly auditLogsRepository;
    private readonly calculationsService;
    constructor(usersRepository: Repository<User>, companiesRepository: Repository<Company>, userCompaniesRepository: Repository<UserCompany>, sitesRepository: Repository<Site>, userSitesRepository: Repository<UserSite>, workersRepository: Repository<Worker>, workerSitesRepository: Repository<WorkerSite>, periodsRepository: Repository<Period>, attendancesRepository: Repository<Attendance>, auditLogsRepository: Repository<AuditLog>, calculationsService: CalculationsService);
    build(user: AuthenticatedUser): Promise<DashboardResponse>;
    private buildAdmin;
    private buildManager;
    private buildSupervisor;
    private buildViewer;
    private loadManagerCompanyIds;
    private loadCompaniesByIds;
    private buildCardsForSites;
    private totalRemunerationFor;
    private countPeriodsByStatus;
    private toPeriodAlerts;
    private findSitesWithoutRecentAttendance;
    private countWorkingDays;
    private round;
}
