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

export const redditOperations: readonly UnifapiOperationDefinition[] = [
  {
    name: "browse_reddit_feed_home",
    operationId: "getRedditFeedHome",
    description: "Browse Reddit's anonymous home feed.",
    method: "GET",
    path: "/reddit/feed/home",
    pathFields: [],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Browse Reddit's anonymous home feed.",
    },
    paginated: true,
  },
  {
    name: "browse_reddit_feed_news",
    operationId: "getRedditFeedNews",
    description: "Browse Reddit's news feed.",
    method: "GET",
    path: "/reddit/feed/news",
    pathFields: [],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Browse Reddit's news feed.",
    },
    paginated: true,
  },
  {
    name: "browse_reddit_feed_popular",
    operationId: "getRedditFeedPopular",
    description: "Browse Reddit's popular feed.",
    method: "GET",
    path: "/reddit/feed/popular",
    pathFields: [],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Browse Reddit's popular feed.",
    },
    paginated: true,
  },
  {
    name: "list_reddit_post_comments",
    operationId: "getRedditPostsByIdComments",
    description: "List Reddit comments on a post.",
    method: "GET",
    path: "/reddit/posts/{id}/comments",
    pathFields: ["id"],
    queryFields: ["cursor"],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        id: {
          type: "string",
          minLength: 1,
          description: "Reddit post fullname, e.g. `t3_1thjm1o`.",
        },
        cursor: {
          type: "string",
          description: "The cursor value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for List Reddit comments on a post.",
      required: ["id"],
    },
    paginated: true,
  },
  {
    name: "get_reddit_post",
    operationId: "getRedditPostsById",
    description: "Get a Reddit post by id.",
    method: "GET",
    path: "/reddit/posts/{id}",
    pathFields: ["id"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        id: {
          type: "string",
          minLength: 1,
          description: "Reddit post fullname, e.g. `t3_1thjm1o`.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Get a Reddit post by id.",
      required: ["id"],
    },
    paginated: false,
  },
  {
    name: "get_reddit_subreddit",
    operationId: "getRedditSubredditsByName",
    description: "Get a Reddit subreddit by name.",
    method: "GET",
    path: "/reddit/subreddits/{name}",
    pathFields: ["name"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        name: {
          type: "string",
          minLength: 1,
          description: "Subreddit slug without `r/`, e.g. `pics`.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Get a Reddit subreddit by name.",
      required: ["name"],
    },
    paginated: false,
  },
  {
    name: "list_reddit_trending_searches",
    operationId: "getRedditTrendingSearches",
    description: "List Reddit's current trending search queries.",
    method: "GET",
    path: "/reddit/trending-searches",
    pathFields: [],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {},
      additionalProperties: false,
      description: "The input payload for List Reddit's current trending search queries.",
    },
    paginated: false,
  },
  {
    name: "list_reddit_user_comments",
    operationId: "getRedditUsersByUsernameComments",
    description: "List Reddit comments authored by a user.",
    method: "GET",
    path: "/reddit/users/{username}/comments",
    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 Reddit comments authored by a user.",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "list_reddit_user_posts",
    operationId: "getRedditUsersByUsernamePosts",
    description: "List Reddit posts authored by a user.",
    method: "GET",
    path: "/reddit/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 Reddit posts authored by a user.",
      required: ["username"],
    },
    paginated: true,
  },
  {
    name: "get_reddit_user",
    operationId: "getRedditUsersByUsername",
    description: "Get a Reddit user profile by username.",
    method: "GET",
    path: "/reddit/users/{username}",
    pathFields: ["username"],
    queryFields: [],
    bodyFields: [],
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          minLength: 1,
          description: "The username value.",
        },
      },
      additionalProperties: false,
      description: "The input payload for Get a Reddit user profile by username.",
      required: ["username"],
    },
    paginated: false,
  },
];
