import { GraphQLBoolean, GraphQLInputObjectType, GraphQLInt, GraphQLList, GraphQLString } from 'graphql';

import { createModuleNameFromMetaUrl } from '../../../_helpers/common';

export const PAYLOAD_NAME = createModuleNameFromMetaUrl(import.meta.url);

export default new GraphQLInputObjectType({
  name: PAYLOAD_NAME,
  fields: {
    id: {
      type: GraphQLInt,
    },
    accountId: {
      type: GraphQLInt,
    },
    firstName: {
      type: GraphQLString,
    },
    lastName: {
      type: GraphQLString,
    },
    enable2fa: {
      type: GraphQLBoolean,
    },
    roleId: {
      type: GraphQLInt,
    },
    timezone: {
      type: GraphQLString,
    },
    department: {
      type: new GraphQLInputObjectType({
        name: `${PAYLOAD_NAME}_department`,
        fields: {
          id: {
            type: GraphQLInt,
          },
          name: {
            type: GraphQLString,
          },
        },
      }),
    },
    departmentId: {
      type: GraphQLInt,
    },
    contentOwnerId: {
      type: GraphQLInt,
    },
    defaultHub: {
      type: GraphQLInt,
    },
    publisherIds: {
      type: new GraphQLList(GraphQLInt),
    },
    allSites: {
      type: GraphQLBoolean,
    },
    email: {
      type: GraphQLString,
    },
    status: {
      type: GraphQLInt,
    },
    sendInvite: {
      type: GraphQLBoolean,
    },
  },
});
