def main():
    """
    Main function to process industry classifications for financial instruments.

    Parses command line arguments and executes the industry classification workflow.
    """
    # Set up argument parser
    parser = argparse.ArgumentParser(
        description="Process instrument industry using Gemini AI"
    )
    parser.add_argument("--dataset", required=True, help="Path to CSV dataset file")
    parser.add_argument(
        "--symbol-column", required=True, help="Column name containing symbols/tickers"
    )
    parser.add_argument(
        "--name-column", required=True, help="Column name containing instrument names"
    )
    parser.add_argument(
        "--summary-column",
        required=True,
        help="Column name containing summaries/descriptions",
    )
    parser.add_argument(
        "--industry-column",
        required=False,
        default="industry",
        help="Column name containing industry",
    )
    parser.add_argument(
        "--industry-group-column",
        required=False,
        default="industry_group",
        help="Column name containing industry group",
    )
    parser.add_argument(
        "--sector-column",
        required=False,
        default="sector",
        help="Column name containing sector",
    )
    parser.add_argument("--all-rows", action="store_true", help="Process all rows")
    parser.add_argument(
        "--output", required=True, help="Path to save the pickle file with categories"
    )
    parser.add_argument(
        "--batch-size",
        type=int,
        default=100,
        help="Number of instruments to process in each batch",
    )
    parser.add_argument(
        "--model", default="gemini-2.0-flash", help="Gemini model to use"
    )
    parser.add_argument(
        "--skip-confirmation",
        action="store_true",
        help="Skip confirmation of category options",
    )

    args = parser.parse_args()

    try:
        # Confirm if the current OPTIONS list is desired
        if not args.skip_confirmation:
            print("Current category options:")
            for sector, items in OPTIONS.items():
                print(f"{sector}: {items}")

            confirmation = input("\nAre these industries correct? (y/n): ").lower()
            if confirmation not in ["y", "yes"]:
                print("Please modify the OPTIONS list in the script and run again.")
                sys.exit(0)

        # Load and filter dataset
        dataset = helpers.load_dataset(args.dataset)
        filtered_dataset = filter_dataset(
            dataset, args.industry_column, args.name_column, args.all_rows
        )

        # Load existing categories
        categories_dict = helpers.load_existing(args.output)

        # Process categories
        process_categories(
            dataset=filtered_dataset,
            symbol_column=args.symbol_column,
            name_column=args.name_column,
            summary_column=args.summary_column,
            industry_group_column=args.industry_group_column,
            sector_column=args.sector_column,
            pickle_file_name=args.output,
            categories_dict=categories_dict,
            batch_size=args.batch_size,
            model=args.model,
        )
    except Exception as e:
        print(f"Error: {e}")
        sys.exit(1)

    Main function to process industry classifications for financial instruments.

    Parses command line arguments and executes the industry classification workflow.
    
parsers/industry_controller.py