/**
 * Reflection self-report DTO — class-validator boundary.
 *
 * Validates the agent-supplied self-report input (the optional
 * `$REFLECTION_INPUT` file, default `<repo>/.mosaic/reflection-input.json`)
 * before it is merged into a `reflection.v1` record. This is the only
 * externally-authored input on the reflection path, so it gets a DTO per the
 * Mosaic module-boundary rule.
 *
 * Class-validator only (no class-transformer `@Type`) — matching `chat.dto.ts`
 * — so the module is safe to import without a `reflect-metadata` shim. Deep
 * nested validation of `most_likely_wrong` is owned by the zod
 * `ReflectionSelfReportSchema` in `reflection.ts`, which is what the Stop hook
 * actually enforces at runtime.
 */

import {
  IsIn,
  IsNumber,
  IsObject,
  IsOptional,
  IsString,
  Max,
  Min,
  MaxLength,
} from 'class-validator';

import { REVIEW_SURFACES } from './reflection.js';

/** Shape of `most_likely_wrong`; validated structurally by zod at runtime. */
export class MostLikelyWrongDto {
  @IsIn(REVIEW_SURFACES as unknown as string[])
  surface!: string;

  @IsString()
  @MaxLength(4_000)
  description!: string;
}

export class ReflectionSelfReportDto {
  @IsOptional()
  @IsNumber()
  @Min(0)
  @Max(1)
  confidence?: number;

  @IsOptional()
  @IsObject()
  most_likely_wrong?: MostLikelyWrongDto;

  @IsOptional()
  @IsString()
  @MaxLength(8_000)
  known_not_in_diff?: string;
}
