from __future__ import annotations

from dataclasses import dataclass

import libcst

from core.shared.optimizer_models import OptimizeSchema


@dataclass(frozen=True)
class CodeAndExplanation:
    cst_module: libcst.Module | None
    explanation: str


@dataclass(frozen=True)
class CodeExplanationAndID:
    cst_module: libcst.Module
    explanation: str
    id: str


class JitRewriteOptimizeSchema(OptimizeSchema):
    n_candidates: int = 1  # default value for backward compatibility
