import { defineModule, defineRoute } from "../../shared/define-module"
import type {
  UploadAvatarRequest,
  UploadAvatarResponse,
  UploadChatAttachmentRequest,
  UploadChatAttachmentResponse,
} from "./types"

/**
 * Upload module for file uploads
 */
export const uploadModule = defineModule({
  name: "upload",
  prefix: "/upload",
  routes: {
    // Upload avatar image
    uploadAvatar: defineRoute<UploadAvatarRequest, UploadAvatarResponse>(
      "POST",
      "/avatar",
      { requestType: "formData" },
    ),
    // Upload chat attachment file (md, images, txt, pdf)
    uploadChatAttachment: defineRoute<UploadChatAttachmentRequest, UploadChatAttachmentResponse>(
      "POST",
      "/chat-attachment",
      { requestType: "formData" },
    ),
  },
})

// Export the API type
export type UploadAPI = typeof uploadModule.api

// Re-export types for external consumption
export type * from "./types"
