import { type FieldType } from "./enums.js";

export interface BlueprintFieldDefinition {
  id: string;
  label: string;
  key: string;
  type: FieldType;
  required: boolean;
  description?: string;
  placeholder?: string;
  defaultValue?: unknown;
  options?: FieldOption[];
  validation?: FieldValidation;
  order: number;
  group?: string;
  showInList?:   boolean;
  showInDetail?: boolean;
  isFilterable?: boolean;
  isSortable?:   boolean;
  width?:        number;
}

export interface FieldOption {
  value: string;
  label: string;
  color?: string;
}

export interface FieldValidation {
  min?: number;
  max?: number;
  minLength?: number;
  maxLength?: number;
  pattern?: string;
  message?: string;
}

export type DynamicFields = Record<string, unknown>;

export interface BlueprintValidationRule {
  field: string;
  rule: "required_if" | "unique" | "min" | "max";
  params?: unknown;
  message?: string;
}
