/**
 * DTO: EligibilityFilterDto
 * 
 * DSL-based eligibility filter for league/competition rules.
 * Example: "platform.driving >= 55 OR external.iracing.iRating between 2000 2500"
 */

export interface EligibilityFilterDto {
  /**
   * DSL expression for eligibility rules
   * Supports:
   * - Comparisons: >=, <=, >, <, =, !=, between
   * - Logical: AND, OR, NOT
   * - Dimensions: platform.{dimension}, external.{game}.{type}
   * 
   * Examples:
   * - "platform.driving >= 55"
   * - "external.iracing.iRating between 2000 2500"
   * - "platform.driving >= 55 AND external.iracing.iRating >= 2000"
   * - "platform.driving >= 55 OR external.iracing.iRating between 2000 2500"
   */
  dsl: string;
  
  /**
   * Optional context for evaluation
   */
  context?: {
    userId?: string;
    leagueId?: string;
    [key: string]: unknown;
  };
}

export interface EligibilityCondition {
  target: 'platform' | 'external';
  dimension?: string; // e.g., 'driving', 'admin', 'iRating'
  game?: string; // e.g., 'iracing'
  operator: string; // '>=', '<=', '>', '<', '=', '!=', 'between'
  expected: number | [number, number];
}

export interface ParsedEligibilityFilter {
  conditions: EligibilityCondition[];
  logicalOperator: 'AND' | 'OR';
}
