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

const RuleType = new GraphQLInputObjectType({
  name: 'HubRuleType',
  description: 'HubRuleType',
  fields: {
    cleanOrder: {
      type: GraphQLInt,
    },
    cleanUrl: {
      type: GraphQLString,
    },
    cleanUrlRuleType: {
      type: GraphQLString,
    },
    cleanUrlRuleValue: {
      type: GraphQLString,
    },
    id: {
      type: GraphQLInt,
    },
    publisherId: {
      type: GraphQLInt,
    },
  },
});

export const ITEM_INPUT_TYPE_NAME = 'ModuleHubInputType';

const ItemInputType = new GraphQLInputObjectType({
  name: ITEM_INPUT_TYPE_NAME,
  description: 'Module Hub Create Input Type',
  fields: {
    id: {
      type: GraphQLInt,
    },
    accountId: {
      type: GraphQLInt,
    },
    accounts: {
      type: new GraphQLList(
        new GraphQLInputObjectType({
          name: 'ModuleHubSyndicatedAccount',
          description: 'ModuleHubSyndicatedAccount',
          fields: {
            id: {
              type: GraphQLInt,
            },
            name: {
              type: GraphQLString,
            },
            salesforceId: {
              type: GraphQLString,
            },
          },
        }),
      ),
    },
    cleanUrl: {
      type: new GraphQLList(RuleType),
    },
    cpm: {
      type: GraphQLFloat,
    },
    ddSpecificPublisher: {
      type: GraphQLBoolean,
    },
    defaultRule: {
      type: RuleType,
    },
    domains: {
      type: new GraphQLList(GraphQLString),
    },
    firstLook: {
      type: GraphQLBoolean,
    },
    includePublicContent: {
      type: GraphQLBoolean,
    },
    monetization: {
      type: GraphQLBoolean,
    },
    name: {
      type: GraphQLString,
    },
    pageRefresh: {
      type: GraphQLBoolean,
    },
    publish: {
      type: GraphQLBoolean,
    },
    refreshIntervalMinutes: {
      type: GraphQLInt,
    },
    refreshTimesLimit: {
      type: GraphQLInt,
    },
    selfService: {
      type: GraphQLBoolean,
    },
    mpSelfService: {
      type: GraphQLBoolean,
    },
    demandAccountId: {
      type: GraphQLInt,
    },
    templatePlayerLumN: {
      type: GraphQLInt,
    },
    templatePlayerLumNAmp: {
      type: GraphQLInt,
    },
    templatePlayerLumX: {
      type: GraphQLInt,
    },
    templatePlayerLumXAmp: {
      type: GraphQLInt,
    },
    templatePlayerVertical: {
      type: GraphQLInt,
    },
    templatePlayerOutstream: {
      type: GraphQLInt,
    },
  },
});

export default ItemInputType;
