import type { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
  overwrite: true,
  schema: 'http://localhost:5000/graphql',
  documents: 'src/**/*.ts',
  generates: {
    'src/app/core/graphql/generated/types.ts': {
      plugins: [
        'typescript',
        'typescript-operations',
      ],
      config: {
        strictScalars: true,
        scalars: {
          DateTime: 'string',
          Date: 'string',
          UUID: 'string',
        },
        enumsAsTypes: true,
        avoidOptionals: {
          field: true,
          inputValue: false,
          object: true,
        },
        maybeValue: 'T | null',
      },
    },
  },
};

export default config;
