export type RuntimeFieldType =
  | 'text'
  | 'textarea'
  | 'number'
  | 'email'
  | 'tel'
  | 'date'
  | 'select'
  | 'radio'
  | 'url'
  | 'file'
  | 'checkbox';

export type RuntimeOption = {
  label: string;
  value: string;
  imageUrl?: string;
};

export type RuntimeVisibilityCondition = {
  field: string;
  equals?: string;
  in?: string[];
};

export type RuntimeValidation = {
  minLength?: number;
  maxLength?: number;
  min?: number;
  max?: number;
  pattern?: string;
};

export type RuntimeOnboardingField = {
  id: string;
  label: string;
  type: RuntimeFieldType;
  required?: boolean;
  placeholder?: string;
  helperText?: string;
  defaultValue?: string | number | boolean | string[];
  readOnly?: boolean;
  multiple?: boolean;
  options?: RuntimeOption[];
  accept?: string;
  maxFiles?: number;
  maxSizeMB?: number;
  validation?: RuntimeValidation;
  visibleWhen?: RuntimeVisibilityCondition[];
};

export type RuntimeOnboardingStep = {
  id: string;
  title: string;
  description?: string;
  visibleWhen?: RuntimeVisibilityCondition[];
  fields: RuntimeOnboardingField[];
};

export type RuntimeOnboardingConfig = {
  schemaId: string;
  roleKey: string;
  version: number;
  steps: RuntimeOnboardingStep[];
};

export type UploadedFileMeta = {
  name: string;
  type: string;
  size: number;
  uploadedAt: string;
};

export type OnboardingSubmission = {
  id: string;
  schemaId: string;
  roleKey: string;
  submittedAt: string;
  values: Record<string, unknown>;
};

export type RuntimeKBArticle = {
  id: string;
  title: string;
  category: string;
  content: string;
  author: string;
  isPublished: boolean;
  viewCount: number;
  lastUpdated: string;
};

export type RuntimeKBConfig = {
  articles: RuntimeKBArticle[];
};
