/**
 * @aurora-catalyst-generated
 * @source cliter/iam/tenant.aurora.yaml
 */
import { BooleanCell, type DataTableColumnDef } from '@aurora';
import { TranslocoService } from '@jsverse/transloco';
import { type IamTenant } from '@src/src/app/aurora.types';
import { flexRenderComponent } from '@tanstack/angular-table';

export const getTenantStandaloneColumns = (properties?: {
  translator?: TranslocoService;
}): DataTableColumnDef<IamTenant>[] => {
  const { translator = null } = properties ?? {};

  return [
    {
      accessorKey: 'rowId',
      id: 'rowId',
      size: 100,
      label: () => translator?.translate('iam.tenant.RowId') ?? 'RowId',
      sortable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorFn: (row) => row.parent?.name ?? '',
      id: 'parent.name',
      size: 220,
      minSize: 140,
      relation: { association: 'parent' },
      label: () => translator?.translate('iam.tenant.ParentId') ?? 'Tenant',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'name',
      id: 'name',
      size: 300,
      minSize: 160,
      label: () => translator?.translate('iam.tenant.Name') ?? 'Name',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'code',
      id: 'code',
      size: 200,
      minSize: 120,
      label: () => translator?.translate('iam.tenant.Code') ?? 'Code',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'logo',
      id: 'logo',
      size: 200,
      minSize: 120,
      label: () => translator?.translate('iam.tenant.Logo') ?? 'Logo',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'isActive',
      id: 'isActive',
      size: 100,
      label: () => translator?.translate('iam.tenant.IsActive') ?? 'IsActive',
      sortable: true,
      filterable: true,
      exportable: true,
      cell: () => flexRenderComponent(BooleanCell, { inputs: {} }),
    },
  ];
};
