import { z } from 'zod';
import { filterTypes } from './constants';

export type ColumnType =
  | 'string'
  | 'number'
  | 'boolean'
  | 'date'
  | 'object'
  | 'array';

export const FilterType = z.enum(filterTypes);
export type FilterType = z.infer<typeof FilterType>;

export type Alignment = 'start' | 'center' | 'end';

export type Option = { label: string; value: string };

export type Column = {
  name: string;
  type: ColumnType;
  dataName?: string;
  label?: string;
  readonly?: boolean;
  required?: boolean;
  sortable?: boolean;
  supportedFilters?: FilterType[];
  align?: [Alignment, Alignment];
  freezed?: boolean;
  width?: number;
  visible?: boolean;

  textOverflow?: 'ellipsis' | 'wrap';

  // Type specific options
  options?: Option[];
  dateFormat?: string;
};
