import { 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,
    },
    publisherId: {
      type: GraphQLInt,
    },
    xrayCampaignId: {
      type: GraphQLInt,
    },
    name: {
      type: GraphQLString,
    },
    status: {
      type: GraphQLInt,
    },
    priority: {
      type: GraphQLInt,
    },
    xrayCreatives: {
      type: new GraphQLList(
        new GraphQLInputObjectType({
          name: `${PAYLOAD_NAME}_xrayCreatives`,
          fields: {
            id: {
              type: GraphQLInt,
            },
          },
        }),
      ),
    },
  },
});
