import type { Visibility } from "@/core/module-registry/types";
import type { CompanyId } from "@/core/auth/types";

export type TemplateCategory =
  | "contract"
  | "memoriu"
  | "oferta"
  | "raport"
  | "cerere"
  | "aviz"
  | "scrisoare"
  | "altele";

export type TemplateFileType =
  | "docx"
  | "xlsx"
  | "pdf"
  | "dwg"
  | "archicad"
  | "other";

export interface TemplateVersionEntry {
  version: string;
  fileUrl: string;
  notes: string;
  createdAt: string;
}

export interface WordTemplate {
  id: string;
  name: string;
  description: string;
  category: TemplateCategory;
  /** Primary URL or link to current version */
  fileUrl: string;
  /** Detected file type from extension */
  fileType: TemplateFileType;
  company: CompanyId;
  /** Detected placeholders in template (only for .docx) */
  placeholders: string[];
  /** Cloned from template ID */
  clonedFrom?: string;
  tags: string[];
  version: string;
  /** History of previous versions */
  versionHistory: TemplateVersionEntry[];
  visibility: Visibility;
  createdAt: string;
  updatedAt: string;
}
