import type {
  RegexEngineOptions,
  RegexFlavourId,
} from "../regex/model/flavour";
import type { RegexResourceLimits } from "../regex/execution/request-limits";
import type { ListTemplate } from "../regex/list/list-template";
import type { RegexTestCase } from "../regex/tests/test-case.types";

export type WorkspaceMode = "match" | "replace" | "list" | "corpus" | "tests";

export interface RegexProjectV1 {
  readonly schemaVersion: 1;
  readonly id: string;
  readonly name: string;
  readonly createdAt: string;
  readonly updatedAt: string;
  readonly flavour: RegexFlavourId;
  readonly flavourVersion?: string;
  readonly pattern: string;
  readonly flags: readonly string[];
  readonly options: RegexEngineOptions;
  readonly replacement?: string;
  readonly mode: WorkspaceMode;
  readonly testText?: {
    readonly included: boolean;
    readonly value?: string;
  };
  readonly listTemplate?: ListTemplate;
  readonly tests: readonly RegexTestCase[];
  readonly resourceOverrides?: Partial<RegexResourceLimits>;
  readonly ui?: {
    readonly live: boolean;
    readonly scanAll: boolean;
  };
}

export interface ProjectExportOptions {
  readonly includeTestText: boolean;
  readonly includeUnitTestSubjects: boolean;
}
