/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/authorization-code.aurora.yaml
 */
import { BooleanCell, type DataTableColumnDef } from '@aurora';
import { TranslocoService } from '@jsverse/transloco';
import { type OAuthAuthorizationCode } from '@src/src/app/aurora.types';
import { flexRenderComponent } from '@tanstack/angular-table';

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

  return [
    {
      accessorKey: 'rowId',
      id: 'rowId',
      size: 100,
      label: () => translator?.translate('o-auth.authorization-code.RowId') ?? 'RowId',
      sortable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'code',
      id: 'code',
      size: 200,
      minSize: 120,
      label: () => translator?.translate('o-auth.authorization-code.Code') ?? 'Code',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'client.name',
      id: 'client.name',
      size: 220,
      minSize: 140,
      relation: { association: 'client' },
      label: () => translator?.translate('o-auth.authorization-code.Client') ?? 'Client',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'redirectUri',
      id: 'redirectUri',
      size: 300,
      minSize: 160,
      label: () => translator?.translate('o-auth.authorization-code.RedirectUri') ?? 'RedirectUri',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'scopes',
      id: 'scopes',
      size: 200,
      minSize: 120,
      label: () => translator?.translate('o-auth.authorization-code.Scopes') ?? 'Scopes',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'codeChallenge',
      id: 'codeChallenge',
      size: 300,
      minSize: 160,
      label: () =>
        translator?.translate('o-auth.authorization-code.CodeChallenge') ?? 'CodeChallenge',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'codeChallengeMethod',
      id: 'codeChallengeMethod',
      size: 200,
      minSize: 120,
      label: () =>
        translator?.translate('o-auth.authorization-code.CodeChallengeMethod') ??
        'CodeChallengeMethod',
      sortable: true,
      searchable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'expiresAt',
      id: 'expiresAt',
      size: 140,
      label: () => translator?.translate('o-auth.authorization-code.ExpiresAt') ?? 'ExpiresAt',
      sortable: true,
      filterable: true,
      exportable: true,
      cell: (info) => `${info.getValue<string>() ?? ''}`,
    },
    {
      accessorKey: 'isUsed',
      id: 'isUsed',
      size: 100,
      label: () => translator?.translate('o-auth.authorization-code.IsUsed') ?? 'IsUsed',
      sortable: true,
      filterable: true,
      exportable: true,
      cell: () => flexRenderComponent(BooleanCell, { inputs: {} }),
    },
  ];
};
