import type { UnifapiOperationDefinition } from "../operations.ts";

export const instagramOperations: readonly UnifapiOperationDefinition[] = [
  {
    name: "browse_instagram_explore",
    operationId: "getInstagramExplore",
    description: "Browse Instagram's Explore feed.",
    method: "GET",
    path: "/instagram/explore",
    pathFields: [],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Browse Instagram's Explore feed.",
    },
    paginated: true,
  },
  {
    name: "list_instagram_nearby_locations",
    operationId: "getInstagramLocationsByIdNearby",
    description: "List Instagram locations geographically near a given location.",
    method: "GET",
    path: "/instagram/locations/{id}/nearby",
    pathFields: ["id"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        id: {
          type: "string",
          minLength: 1,
          description: "The id value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List Instagram locations geographically near a given location.",
      required: ["id"],
    },
    paginated: false,
  },
  {
    name: "list_instagram_location_posts",
    operationId: "getInstagramLocationsByIdPosts",
    description: "List posts tagged with an Instagram location.",
    method: "GET",
    path: "/instagram/locations/{id}/posts",
    pathFields: ["id"],
    queryFields: ["cursor", "tab"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        id: {
          type: "string",
          minLength: 1,
          description: "The id value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
        tab: {
          type: "string",
          enum: ["ranked", "recent"],
          description: "Which tab to fetch - `ranked` (top) or `recent` (latest).",
        },
      },
      additionalProperties: false,
      description: "The input payload for List posts tagged with an Instagram location.",
      required: ["id"],
    },
    paginated: true,
  },
  {
    name: "get_instagram_location",
    operationId: "getInstagramLocationsById",
    description: "Get an Instagram location by id.",
    method: "GET",
    path: "/instagram/locations/{id}",
    pathFields: ["id"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        id: {
          type: "string",
          minLength: 1,
          description: "Numeric Instagram location id.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Get an Instagram location by id.",
      required: ["id"],
    },
    paginated: false,
  },
  {
    name: "list_instagram_post_comment_replies",
    operationId: "getInstagramPostsByShortcodeCommentsByCommentIdReplies",
    description: "List replies to an Instagram comment.",
    method: "GET",
    path: "/instagram/posts/{shortcode}/comments/{commentId}/replies",
    pathFields: ["shortcode", "commentId"],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        shortcode: {
          type: "string",
          minLength: 1,
          description: "The shortcode value.",
        },
        commentId: {
          type: "string",
          minLength: 1,
          description: "The commentId value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List replies to an Instagram comment.",
      required: ["shortcode", "commentId"],
    },
    paginated: true,
  },
  {
    name: "list_instagram_post_comments",
    operationId: "getInstagramPostsByShortcodeComments",
    description: "List comments on an Instagram post.",
    method: "GET",
    path: "/instagram/posts/{shortcode}/comments",
    pathFields: ["shortcode"],
    queryFields: ["cursor", "sort"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        shortcode: {
          type: "string",
          minLength: 1,
          description: "The shortcode value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
        sort: {
          type: "string",
          enum: ["popular", "newest"],
          description: "The sort value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List comments on an Instagram post.",
      required: ["shortcode"],
    },
    paginated: true,
  },
  {
    name: "get_instagram_post",
    operationId: "getInstagramPostsByShortcode",
    description: "Get an Instagram post (photo / video / carousel / reel) by shortcode.",
    method: "GET",
    path: "/instagram/posts/{shortcode}",
    pathFields: ["shortcode"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        shortcode: {
          type: "string",
          minLength: 1,
          description: "The shortcode value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Get an Instagram post (photo / video / carousel / reel) by shortcode.",
      required: ["shortcode"],
    },
    paginated: false,
  },
  {
    name: "browse_instagram_recommended_reels",
    operationId: "getInstagramReelsRecommended",
    description: "Browse Instagram's recommended Reels feed.",
    method: "GET",
    path: "/instagram/reels/recommended",
    pathFields: [],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Browse Instagram's recommended Reels feed.",
    },
    paginated: true,
  },
  {
    name: "convert_instagram_media_id",
    operationId: "getInstagramResolveMediaId",
    description: "Convert an Instagram post shortcode into its numeric media_id.",
    method: "GET",
    path: "/instagram/resolve/media-id",
    pathFields: [],
    queryFields: ["shortcode"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        shortcode: {
          type: "string",
          minLength: 1,
          description: "The shortcode value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Convert an Instagram post shortcode into its numeric media_id.",
      required: ["shortcode"],
    },
    paginated: false,
  },
  {
    name: "convert_instagram_shortcode_from_media",
    operationId: "getInstagramResolveShortcodeFromMedia",
    description: "Convert an Instagram numeric media_id into its shortcode.",
    method: "GET",
    path: "/instagram/resolve/shortcode-from-media",
    pathFields: [],
    queryFields: ["media_id"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        media_id: {
          type: "string",
          minLength: 1,
          description: "The media_id value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Convert an Instagram numeric media_id into its shortcode.",
      required: ["media_id"],
    },
    paginated: false,
  },
  {
    name: "extract_instagram_shortcode",
    operationId: "getInstagramResolveShortcode",
    description: "Extract a post shortcode from an Instagram URL.",
    method: "GET",
    path: "/instagram/resolve/shortcode",
    pathFields: [],
    queryFields: ["url"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        url: {
          type: "string",
          format: "uri",
          description: "The url value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Extract a post shortcode from an Instagram URL.",
      required: ["url"],
    },
    paginated: false,
  },
  {
    name: "convert_instagram_user_id",
    operationId: "getInstagramResolveUserId",
    description: "Convert an Instagram username into its numeric user_id (pk).",
    method: "GET",
    path: "/instagram/resolve/user-id",
    pathFields: [],
    queryFields: ["username"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Convert an Instagram username into its numeric user_id (pk).",
      required: ["username"],
    },
    paginated: false,
  },
  {
    name: "search_instagram",
    operationId: "getInstagramSearch",
    description: "Cross-type Instagram search (posts/reels).",
    method: "GET",
    path: "/instagram/search",
    pathFields: [],
    queryFields: ["cursor", "q"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
        q: {
          type: "string",
          minLength: 1,
          description: "Search keyword.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Cross-type Instagram search (posts/reels).",
      required: ["q"],
    },
    paginated: true,
  },
  {
    name: "list_instagram_user_followers",
    operationId: "getInstagramUsersByUsernameFollowers",
    description: "List followers of an Instagram user.",
    method: "GET",
    path: "/instagram/users/{username}/followers",
    pathFields: ["username"],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List followers of an Instagram user.",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "list_instagram_user_following",
    operationId: "getInstagramUsersByUsernameFollowing",
    description: "List accounts an Instagram user follows.",
    method: "GET",
    path: "/instagram/users/{username}/following",
    pathFields: ["username"],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List accounts an Instagram user follows.",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "list_instagram_user_former_usernames",
    operationId: "getInstagramUsersByUsernameFormerUsernames",
    description: "List former usernames for an Instagram user.",
    method: "GET",
    path: "/instagram/users/{username}/former-usernames",
    pathFields: ["username"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List former usernames for an Instagram user.",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "list_instagram_user_highlights",
    operationId: "getInstagramUsersByUsernameHighlights",
    description: "List Instagram highlight reels for a user (metadata only).",
    method: "GET",
    path: "/instagram/users/{username}/highlights",
    pathFields: ["username"],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List Instagram highlight reels for a user (metadata only).",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "list_instagram_user_posts",
    operationId: "getInstagramUsersByUsernamePosts",
    description: "List feed posts authored by an Instagram user.",
    method: "GET",
    path: "/instagram/users/{username}/posts",
    pathFields: ["username"],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List feed posts authored by an Instagram user.",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "list_instagram_user_reels",
    operationId: "getInstagramUsersByUsernameReels",
    description: "List reels authored by an Instagram user.",
    method: "GET",
    path: "/instagram/users/{username}/reels",
    pathFields: ["username"],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List reels authored by an Instagram user.",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "get_instagram_user",
    operationId: "getInstagramUsersByUsername",
    description: "Get an Instagram user profile by username.",
    method: "GET",
    path: "/instagram/users/{username}",
    pathFields: ["username"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "Instagram URL slug, e.g. `instagram`",
        },
      },
      additionalProperties: false,
      description: "The input payload for Get an Instagram user profile by username.",
      required: ["username"],
    },
    paginated: false,
  },
  {
    name: "list_instagram_user_stories",
    operationId: "getInstagramUsersByUsernameStories",
    description: "List active Instagram stories for a user.",
    method: "GET",
    path: "/instagram/users/{username}/stories",
    pathFields: ["username"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List active Instagram stories for a user.",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "list_instagram_user_tagged_posts",
    operationId: "getInstagramUsersByUsernameTaggedPosts",
    description: "List posts an Instagram user is tagged in.",
    method: "GET",
    path: "/instagram/users/{username}/tagged-posts",
    pathFields: ["username"],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List posts an Instagram user is tagged in.",
      required: ["username"],
    },
    paginated: true,
  },
];
