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

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

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

export default new GraphQLInputObjectType({
  name: UPSERT_TAGS_PAYLOAD_NAME,
  fields: {
    videoId: {
      type: GraphQLString,
    },
    logRowUid: {
      type: GraphQLString,
    },
    startTime: {
      type: GraphQLInt,
    },
    keywords: {
      type: new GraphQLList(
        new GraphQLInputObjectType({
          name: `${UPSERT_TAGS_PAYLOAD_NAME}_keywords`,
          fields: {
            category: {
              type: GraphQLString,
            },
            value: {
              type: GraphQLString,
            },
            id: {
              type: GraphQLString,
            },
            labelId: {
              type: GraphQLString,
            },
            labelName: {
              type: GraphQLString,
            },
            color: {
              type: GraphQLString,
            },
          },
        }),
      ),
    },
  },
});
