import {
  createColumnLoader,
  ColumnMetadata,
} from '../DataGrid/configBuilderFactory';

const ASSETS_COLUMNS: ColumnMetadata[] = [
  {
    field: 'project',
    headerName: 'Project',
    type: 'singleSelectRelation',
    entityRef: 'projects',
    editable: true,
  },
  { field: 'name', headerName: 'Name', type: 'text', editable: true },
  {
    field: 'asset_type',
    headerName: 'Asset format',
    type: 'text',
    editable: true,
  },
  { field: 'type', headerName: 'Type', type: 'text', editable: true },
  { field: 'cdn_url', headerName: 'CDNURL', type: 'text', editable: true },
  {
    field: 'storage_key',
    headerName: 'Storagekey',
    type: 'text',
    editable: true,
  },
  { field: 'mime_type', headerName: 'MIMEtype', type: 'text', editable: true },
  { field: 'size_mb', headerName: 'Size(MB)', type: 'number', editable: true },
  {
    field: 'width_px',
    headerName: 'Width(px)',
    type: 'number',
    editable: true,
  },
  {
    field: 'height_px',
    headerName: 'Height(px)',
    type: 'number',
    editable: true,
  },
  {
    field: 'duration_sec',
    headerName: 'Duration(sec)',
    type: 'number',
    editable: true,
  },
  { field: 'checksum', headerName: 'Checksum', type: 'text', editable: true },
  {
    field: 'is_public',
    headerName: 'Ispublic',
    type: 'boolean',
    editable: true,
  },
  {
    field: 'is_deleted',
    headerName: 'Isdeleted',
    type: 'boolean',
    editable: true,
  },
  {
    field: 'deleted_at_time',
    headerName: 'Deletedat',
    type: 'datetime',
    editable: true,
  },
  { field: 'actions', headerName: '', type: 'actions' },
];

export const loadColumns = createColumnLoader({
  entityName: 'assets',
  columns: ASSETS_COLUMNS,
});
