import "reflect-metadata"
import type { GraphQLSchema } from "graphql"
import { buildSchema } from "@aet/gql-tools/macro"
import { FileResolver } from "./resolvers/FileResolver"
import { SectionResolver } from "./resolvers/SectionResolver"
import { FindResolver } from "./resolvers/FindResolver"
import { PreferencesResolver } from "./resolvers/PreferencesResolver"
import { DatabaseResolver } from "./resolvers/DatabaseResolver"
import { TagResolver } from "./resolvers/TagResolver"
import { StatisticsResolver } from "./resolvers/StatisticsResolver"
import { CloudResolver } from "./resolvers/CloudResolver"

export function getSchema(): GraphQLSchema {
  return buildSchema({
    validate: process.env.NODE_ENV !== "production",
    disableInferringDefaultValues: true,
    resolvers: [
      DatabaseResolver,
      FindResolver,
      PreferencesResolver,
      SectionResolver,
      FileResolver,
      TagResolver,
      StatisticsResolver,
      CloudResolver,
    ],
  })
}
