import { GraphQLBoolean, GraphQLFloat, 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,
    },
    token: {
      type: GraphQLString,
    },
    code: {
      type: GraphQLString,
    },
    accountId: {
      type: GraphQLInt,
    },
    type: {
      type: GraphQLString,
    },
    name: {
      type: GraphQLString,
    },
    description: {
      type: GraphQLString,
    },
    lang: {
      type: GraphQLString,
    },
    url: {
      type: GraphQLString,
    },
    speechToTextProvider: {
      type: GraphQLString,
    },
    auth_method: {
      type: GraphQLString,
    },
    priorityVerification: {
      type: GraphQLBoolean,
    },
    feedPriority: {
      type: GraphQLFloat,
    },
    resolution: {
      type: GraphQLString,
    },
    schedule_type: {
      type: GraphQLString,
    },
    createClip: {
      type: GraphQLBoolean,
    },
    immediateAvailability: {
      type: GraphQLBoolean,
    },
    skipTaggingForLongClips: {
      type: GraphQLBoolean,
    },
    maxDurationForTagging: {
      type: GraphQLInt,
    },
    accessLevel: {
      type: GraphQLString,
    },
    accessAllPublishers: {
      type: GraphQLBoolean,
    },
    parseKeywordsToLabels: {
      type: GraphQLBoolean,
    },
    iabCategories: {
      type: GraphQLString,
    },
    accessVideoOwnerId: {
      type: GraphQLInt,
    },
    accessPublishers: {
      type: new GraphQLList(
        new GraphQLInputObjectType({
          name: `${PAYLOAD_NAME}accessPublishers`,
          fields: {
            publisherId: {
              type: GraphQLInt,
            },
          },
        }),
      ),
    },
    user: {
      type: GraphQLString,
    },
    password: {
      type: GraphQLString,
    },
    use_for_download: {
      type: GraphQLBoolean,
    },
    schedule_status: {
      type: GraphQLBoolean,
    },
    schedule_value: {
      type: GraphQLString,
    },
    schedule_frequency: {
      type: GraphQLInt,
    },
    defaultTimezoneEnabled: {
      type: GraphQLBoolean,
    },
    defaultTimezone: {
      type: GraphQLString,
    },
    isEvergreenFeed: {
      type: GraphQLBoolean,
    },
    isRestricted: {
      type: GraphQLBoolean,
    },
    keywords: {
      type: GraphQLString,
    },
    maxDuration: {
      type: GraphQLInt,
    },
    importPlot: {
      type: GraphQLBoolean,
    },
    videoFileType: {
      type: GraphQLString,
    },
    fileSelection: {
      type: GraphQLString,
    },
    resolutionValue: {
      type: GraphQLInt,
    },
    minResolutionValue: {
      type: GraphQLInt,
    },
    bitrate: {
      type: GraphQLInt,
    },
    minBitrate: {
      type: GraphQLInt,
    },
    importCCFromMrssFile: {
      type: GraphQLBoolean,
    },
    processVideoVersions: {
      type: GraphQLBoolean,
    },
    versionAttributeName: {
      type: GraphQLString,
    },
    automationScript: {
      type: GraphQLString,
    },
    platformModels: {
      type: new GraphQLList(
        new GraphQLInputObjectType({
          name: `${PAYLOAD_NAME}platformModels`,
          fields: {
            config: {
              type: GraphQLString,
            },
            enabled: {
              type: GraphQLBoolean,
            },
            model: {
              type: GraphQLString,
            },
            platform: {
              type: GraphQLString,
            },
          },
        }),
      ),
    },

    contentXmlStructure: {
      type: GraphQLString,
    },
    thumbnailsXmlStructure: {
      type: GraphQLString,
    },
    keywords_parser_type: {
      type: GraphQLString,
    },
    maxStories: {
      type: GraphQLInt,
    },
    videoDuration: {
      type: GraphQLInt,
    },
    aspectRatio: {
      type: GraphQLString,
    },
    fit: {
      type: GraphQLString,
    },
    videoMaxZoom: {
      type: GraphQLInt,
    },
    jsRendering: {
      type: GraphQLBoolean,
    },
    loadFromLastDays: {
      type: GraphQLInt,
    },
    discardLongClips: {
      type: GraphQLBoolean,
    },
    fillLandingPage: {
      type: GraphQLBoolean,
    },
    status: {
      type: GraphQLInt,
    },
    source: {
      type: new GraphQLInputObjectType({
        name: `${PAYLOAD_NAME}source`,
        fields: {
          deleteAfterImport: {
            type: GraphQLBoolean,
          },
          importParticipantsNames: {
            type: GraphQLBoolean,
          },
        },
      }),
    },
    youtubeContentType: {
      type: GraphQLString,
    },
    youTubeChannelId: {
      type: GraphQLString,
    },
    youTubeLoadFromDate: {
      type: GraphQLString,
    },
    contentType: {
      type: GraphQLString,
    },
    importShortsThumbnail: {
      type: GraphQLBoolean,
    },
  },
});
