import { makeExecutableSchema } from '@graphql-tools/schema'
import reloadQL from '../../schemas/reloadData.graphql'
import type { Resolvers } from './reloadDataType'
import type { Context, SubschemaConfig, SubschemaResolverType } from './typing'

const reloadSchema: SubschemaConfig = {
  schema: makeExecutableSchema<Context>({
    typeDefs: [reloadQL],
    resolvers: {
      Mutation: {
        reloadTable: () => ({
          operationDone: true,
        }),
        reloadExercises: () => ({
          operationDone: true,
        }),
        reloadDefinitions: () => ({
          operationDone: true,
        }),
      },
    } as SubschemaResolverType<Resolvers>,
  }),
}

export default reloadSchema
