import { GraphQLResolveInfo } from 'graphql';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
  ID: { input: string; output: string; }
  String: { input: string; output: string; }
  Boolean: { input: boolean; output: boolean; }
  Int: { input: number; output: number; }
  Float: { input: number; output: number; }
};

export type AggregateSpansResponse = {
  __typename?: 'AggregateSpansResponse';
  averageDuration: Scalars['String']['output'];
  errorCount: Scalars['Int']['output'];
  lastResolved: Scalars['String']['output'];
  resolveCount: Scalars['Int']['output'];
};

export type AggregateSpansWhere = {
  name: Scalars['String']['input'];
  schemaId: Scalars['String']['input'];
};

export type DeleteTracesResponse = {
  __typename?: 'DeleteTracesResponse';
  success: Scalars['Boolean']['output'];
};

export type DeleteTracesWhere = {
  rootSpanName?: InputMaybe<Scalars['String']['input']>;
  schemaId: Scalars['String']['input'];
};

export type ListSchemasResponse = {
  __typename?: 'ListSchemasResponse';
  schemas: Array<Schema>;
};

export type ListSchemasWhere = {
  id?: InputMaybe<Scalars['String']['input']>;
};

export type ListTraceGroupsResponse = {
  __typename?: 'ListTraceGroupsResponse';
  traces: Array<Trace>;
};

export type ListTraceGroupsWhere = {
  id?: InputMaybe<Scalars['String']['input']>;
  rootSpanName?: InputMaybe<Scalars['String']['input']>;
  schemaId?: InputMaybe<Scalars['String']['input']>;
};

export type Mutation = {
  __typename?: 'Mutation';
  deleteTraces: DeleteTracesResponse;
};


export type MutationDeleteTracesArgs = {
  where: DeleteTracesWhere;
};

export type Query = {
  __typename?: 'Query';
  aggregateSpans: AggregateSpansResponse;
  listSchemas: ListSchemasResponse;
  listTraceGroups: ListTraceGroupsResponse;
};


export type QueryAggregateSpansArgs = {
  where: AggregateSpansWhere;
};


export type QueryListSchemasArgs = {
  where?: InputMaybe<ListSchemasWhere>;
};


export type QueryListTraceGroupsArgs = {
  where?: InputMaybe<ListTraceGroupsWhere>;
};

export type Schema = {
  __typename?: 'Schema';
  createdAt: Scalars['String']['output'];
  hash: Scalars['String']['output'];
  id: Scalars['ID']['output'];
  name?: Maybe<Scalars['String']['output']>;
  traceGroups: Array<Trace>;
  typeDefs: Scalars['String']['output'];
};

export type Span = {
  __typename?: 'Span';
  createdAt: Scalars['String']['output'];
  durationNano: Scalars['String']['output'];
  endTimeUnixNano: Scalars['String']['output'];
  errorMessage?: Maybe<Scalars['String']['output']>;
  errorStack?: Maybe<Scalars['String']['output']>;
  graphqlContext?: Maybe<Scalars['String']['output']>;
  graphqlDocument?: Maybe<Scalars['String']['output']>;
  graphqlResult?: Maybe<Scalars['String']['output']>;
  graphqlVariables?: Maybe<Scalars['String']['output']>;
  id: Scalars['ID']['output'];
  kind: Scalars['String']['output'];
  name: Scalars['String']['output'];
  parentSpanId?: Maybe<Scalars['String']['output']>;
  spanId: Scalars['String']['output'];
  startTimeUnixNano: Scalars['String']['output'];
  traceId: Scalars['String']['output'];
  updatedAt: Scalars['String']['output'];
};

export type Trace = {
  __typename?: 'Trace';
  firstSpanErrorMessage?: Maybe<Scalars['String']['output']>;
  firstSpanErrorStack?: Maybe<Scalars['String']['output']>;
  id: Scalars['String']['output'];
  rootSpan?: Maybe<Span>;
  spans: Array<Span>;
  traceId: Scalars['String']['output'];
};



export type ResolverTypeWrapper<T> = Promise<T> | T;


export type ResolverWithResolve<TResult, TParent, TContext, TArgs> = {
  resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
};
export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = ResolverFn<TResult, TParent, TContext, TArgs> | ResolverWithResolve<TResult, TParent, TContext, TArgs>;

export type ResolverFn<TResult, TParent, TContext, TArgs> = (
  parent: TParent,
  args: TArgs,
  context: TContext,
  info: GraphQLResolveInfo
) => Promise<TResult> | TResult;

export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (
  parent: TParent,
  args: TArgs,
  context: TContext,
  info: GraphQLResolveInfo
) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>;

export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (
  parent: TParent,
  args: TArgs,
  context: TContext,
  info: GraphQLResolveInfo
) => TResult | Promise<TResult>;

export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> {
  subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>;
  resolve?: SubscriptionResolveFn<TResult, { [key in TKey]: TResult }, TContext, TArgs>;
}

export interface SubscriptionResolverObject<TResult, TParent, TContext, TArgs> {
  subscribe: SubscriptionSubscribeFn<any, TParent, TContext, TArgs>;
  resolve: SubscriptionResolveFn<TResult, any, TContext, TArgs>;
}

export type SubscriptionObject<TResult, TKey extends string, TParent, TContext, TArgs> =
  | SubscriptionSubscriberObject<TResult, TKey, TParent, TContext, TArgs>
  | SubscriptionResolverObject<TResult, TParent, TContext, TArgs>;

export type SubscriptionResolver<TResult, TKey extends string, TParent = {}, TContext = {}, TArgs = {}> =
  | ((...args: any[]) => SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>)
  | SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>;

export type TypeResolveFn<TTypes, TParent = {}, TContext = {}> = (
  parent: TParent,
  context: TContext,
  info: GraphQLResolveInfo
) => Maybe<TTypes> | Promise<Maybe<TTypes>>;

export type IsTypeOfResolverFn<T = {}, TContext = {}> = (obj: T, context: TContext, info: GraphQLResolveInfo) => boolean | Promise<boolean>;

export type NextResolverFn<T> = () => Promise<T>;

export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs = {}> = (
  next: NextResolverFn<TResult>,
  parent: TParent,
  args: TArgs,
  context: TContext,
  info: GraphQLResolveInfo
) => TResult | Promise<TResult>;



/** Mapping between all available schema types and the resolvers types */
export type ResolversTypes = {
  AggregateSpansResponse: ResolverTypeWrapper<AggregateSpansResponse>;
  AggregateSpansWhere: AggregateSpansWhere;
  Boolean: ResolverTypeWrapper<Scalars['Boolean']['output']>;
  DeleteTracesResponse: ResolverTypeWrapper<DeleteTracesResponse>;
  DeleteTracesWhere: DeleteTracesWhere;
  ID: ResolverTypeWrapper<Scalars['ID']['output']>;
  Int: ResolverTypeWrapper<Scalars['Int']['output']>;
  ListSchemasResponse: ResolverTypeWrapper<ListSchemasResponse>;
  ListSchemasWhere: ListSchemasWhere;
  ListTraceGroupsResponse: ResolverTypeWrapper<ListTraceGroupsResponse>;
  ListTraceGroupsWhere: ListTraceGroupsWhere;
  Mutation: ResolverTypeWrapper<{}>;
  Query: ResolverTypeWrapper<{}>;
  Schema: ResolverTypeWrapper<Schema>;
  Span: ResolverTypeWrapper<Span>;
  String: ResolverTypeWrapper<Scalars['String']['output']>;
  Trace: ResolverTypeWrapper<Trace>;
};

/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = {
  AggregateSpansResponse: AggregateSpansResponse;
  AggregateSpansWhere: AggregateSpansWhere;
  Boolean: Scalars['Boolean']['output'];
  DeleteTracesResponse: DeleteTracesResponse;
  DeleteTracesWhere: DeleteTracesWhere;
  ID: Scalars['ID']['output'];
  Int: Scalars['Int']['output'];
  ListSchemasResponse: ListSchemasResponse;
  ListSchemasWhere: ListSchemasWhere;
  ListTraceGroupsResponse: ListTraceGroupsResponse;
  ListTraceGroupsWhere: ListTraceGroupsWhere;
  Mutation: {};
  Query: {};
  Schema: Schema;
  Span: Span;
  String: Scalars['String']['output'];
  Trace: Trace;
};

export type AggregateSpansResponseResolvers<ContextType = any, ParentType extends ResolversParentTypes['AggregateSpansResponse'] = ResolversParentTypes['AggregateSpansResponse']> = {
  averageDuration?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  errorCount?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
  lastResolved?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  resolveCount?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type DeleteTracesResponseResolvers<ContextType = any, ParentType extends ResolversParentTypes['DeleteTracesResponse'] = ResolversParentTypes['DeleteTracesResponse']> = {
  success?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type ListSchemasResponseResolvers<ContextType = any, ParentType extends ResolversParentTypes['ListSchemasResponse'] = ResolversParentTypes['ListSchemasResponse']> = {
  schemas?: Resolver<Array<ResolversTypes['Schema']>, ParentType, ContextType>;
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type ListTraceGroupsResponseResolvers<ContextType = any, ParentType extends ResolversParentTypes['ListTraceGroupsResponse'] = ResolversParentTypes['ListTraceGroupsResponse']> = {
  traces?: Resolver<Array<ResolversTypes['Trace']>, ParentType, ContextType>;
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type MutationResolvers<ContextType = any, ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']> = {
  deleteTraces?: Resolver<ResolversTypes['DeleteTracesResponse'], ParentType, ContextType, RequireFields<MutationDeleteTracesArgs, 'where'>>;
};

export type QueryResolvers<ContextType = any, ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']> = {
  aggregateSpans?: Resolver<ResolversTypes['AggregateSpansResponse'], ParentType, ContextType, RequireFields<QueryAggregateSpansArgs, 'where'>>;
  listSchemas?: Resolver<ResolversTypes['ListSchemasResponse'], ParentType, ContextType, Partial<QueryListSchemasArgs>>;
  listTraceGroups?: Resolver<ResolversTypes['ListTraceGroupsResponse'], ParentType, ContextType, Partial<QueryListTraceGroupsArgs>>;
};

export type SchemaResolvers<ContextType = any, ParentType extends ResolversParentTypes['Schema'] = ResolversParentTypes['Schema']> = {
  createdAt?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  hash?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
  name?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  traceGroups?: Resolver<Array<ResolversTypes['Trace']>, ParentType, ContextType>;
  typeDefs?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type SpanResolvers<ContextType = any, ParentType extends ResolversParentTypes['Span'] = ResolversParentTypes['Span']> = {
  createdAt?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  durationNano?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  endTimeUnixNano?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  errorMessage?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  errorStack?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  graphqlContext?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  graphqlDocument?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  graphqlResult?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  graphqlVariables?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
  kind?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  parentSpanId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  spanId?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  startTimeUnixNano?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  traceId?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  updatedAt?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type TraceResolvers<ContextType = any, ParentType extends ResolversParentTypes['Trace'] = ResolversParentTypes['Trace']> = {
  firstSpanErrorMessage?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  firstSpanErrorStack?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
  id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  rootSpan?: Resolver<Maybe<ResolversTypes['Span']>, ParentType, ContextType>;
  spans?: Resolver<Array<ResolversTypes['Span']>, ParentType, ContextType>;
  traceId?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type Resolvers<ContextType = any> = {
  AggregateSpansResponse?: AggregateSpansResponseResolvers<ContextType>;
  DeleteTracesResponse?: DeleteTracesResponseResolvers<ContextType>;
  ListSchemasResponse?: ListSchemasResponseResolvers<ContextType>;
  ListTraceGroupsResponse?: ListTraceGroupsResponseResolvers<ContextType>;
  Mutation?: MutationResolvers<ContextType>;
  Query?: QueryResolvers<ContextType>;
  Schema?: SchemaResolvers<ContextType>;
  Span?: SpanResolvers<ContextType>;
  Trace?: TraceResolvers<ContextType>;
};

