/**
 * Usage Tracking DTO
 */

export class RecordUsageDto {
  tenantId: string;
  periodStart: Date;
  periodEnd: Date;
  activeUsers?: number;
  peakConcurrentUsers?: number;
  usersByProfile?: Record<string, number>;
  usersByPlatform?: Record<string, number>;
  activeBranches?: number;
  storageUsedGb?: number;
  documentsCount?: number;
  apiCalls?: number;
  apiErrors?: number;
  salesCount?: number;
  salesAmount?: number;
  invoicesGenerated?: number;
  mobileSessions?: number;
  offlineSyncs?: number;
  paymentTransactions?: number;
}

export class UpdateUsageDto {
  activeUsers?: number;
  peakConcurrentUsers?: number;
  usersByProfile?: Record<string, number>;
  usersByPlatform?: Record<string, number>;
  activeBranches?: number;
  storageUsedGb?: number;
  documentsCount?: number;
  apiCalls?: number;
  apiErrors?: number;
  salesCount?: number;
  salesAmount?: number;
  invoicesGenerated?: number;
  mobileSessions?: number;
  offlineSyncs?: number;
  paymentTransactions?: number;
}

export class IncrementUsageDto {
  tenantId: string;
  metric: keyof UsageMetrics;
  amount?: number;
}

export interface UsageMetrics {
  apiCalls: number;
  apiErrors: number;
  salesCount: number;
  salesAmount: number;
  invoicesGenerated: number;
  mobileSessions: number;
  offlineSyncs: number;
  paymentTransactions: number;
  documentsCount: number;
  storageUsedGb: number;
}

export class UsageReportDto {
  tenantId: string;
  startDate: Date;
  endDate: Date;
  granularity?: 'daily' | 'weekly' | 'monthly';
}

export class UsageSummaryDto {
  tenantId: string;
  currentUsers: number;
  currentBranches: number;
  currentStorageGb: number;
  apiCallsThisMonth: number;
  salesThisMonth: number;
  salesAmountThisMonth: number;
  limits: {
    maxUsers: number;
    maxBranches: number;
    maxStorageGb: number;
    maxApiCalls: number;
  };
  percentages: {
    usersUsed: number;
    branchesUsed: number;
    storageUsed: number;
    apiCallsUsed: number;
  };
}
