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

const config: CodegenConfig = {
  schema: "./src/gql/schema.graphql",
  documents: ["src/**/*.vue", "src/graphql/**/*.ts"],
  ignoreNoDocuments: true,
  hooks: {
    afterAllFileWrite: ["node minimizeGraphqlSchema.mjs"],
  },
  generates: {
    "./src/gql/": {
      preset: "client",
      config: {
        // avoidOptionals: true,
        useTypeImports: true,
        scalars: {
          ID: "string",
          UUID: "string",
          DateTime: "string",
        },
      },
      plugins: [],
    },
    "./src/gql/typenames.ts": {
      plugins: ["./codegenGenerateTypenames.js"],
    },
  },
  config: {
    enumsAsTypes: true,
    namingConvention: {
      typeNames: "change-case-all#pascalCase",
      enumValues: "change-case-all#upperCase",
    },
  },
};

export default config;
