import { GraphQLObjectType, GraphQLString, GraphQLInputObjectType } from 'graphql';
import { globalIdField } from 'graphql-relay';

const setter = ({
  scoreID: {
    type: GraphQLString,
    description: 'id',
  },
  activityRequestID: {
    type: GraphQLString,
    description: 'activity ID',
  },
  activitySearchID: {
    type: GraphQLString,
    description: 'matched activities ids',
  },
  score: {
    type: GraphQLString,
    description: 'matched activities ids',
  },
});

const getter = {
  ...setter,
  id: globalIdField('Score'),
};

const getScoreType = (nodeInterface) => {
  const ScoreType = new GraphQLObjectType({
    name: 'Score',
    description: 'Score',
    fields: getter,
    interfaces: [nodeInterface],
  });
  return ScoreType;
};

const getScoreInputType = () => new GraphQLInputObjectType({
  name: 'ScoreInput',
  fields: setter,
});

export default { getScoreType, getScoreInputType };

