export interface ResolvedReportContext {
  organizationId: string;
  userId: string;
  membershipRole: string;
  businessRole: string;
  businessRoles: string[];
  permissions: string[];
  branchScopeIds: string[];
  productTypeScopeIds: string[];
  ownershipScope: string;
  branchScopeMode: string;
  productScopeMode: string;
  approvalAuthority: string | null;
}

export interface ReportRegistryRow {
  id: string;
  code: string;
  name: string;
  description: string | null;
  category: string;
  categoryLabel: string;
  isSystem: boolean;
  isActive: boolean;
}

export interface ParsedCrmReportFilters {
  dateFrom: string | null;
  dateTo: string | null;
  branch: string | null;
  productType: string | null;
  sales: string | null;
  customer: string | null;
  customerOwner: string | null;
  leadSource: string | null;
  pipelineStage: string | null;
  outcome: string | null;
  lostReason: string | null;
}

export interface PipelineDatasetRecord {
  opportunityId: string;
  opportunityCode: string;
  customerId: string;
  customerName: string;
  branchId: string | null;
  branchLabel: string;
  productTypeId: string | null;
  productTypeLabel: string;
  leadSourceId: string | null;
  leadSourceLabel: string;
  pipelineStage: string;
  createdAt: Date;
  createdByUserId: string;
  createdByName: string;
  assignedToUserId: string | null;
  assignedToName: string | null;
  customerOwnerUserId: string | null;
  customerOwnerName: string;
  quotationCount: number;
  quotationValue: number;
  estimatedValue: number;
  poAmount: number;
  lastFollowupDate: Date | null;
  closedWonAt: Date | null;
  closedLostAt: Date | null;
  lostReason: string | null;
}

