import { defineModule, defineRoute } from "../../shared/define-module"
import type {
  TransactionQuery,
  TransactionsGetResponse,
  WalletsGetResponse,
  WalletsPostResponse,
  WithdrawRequest,
  WithdrawResponse,
} from "./types"

/**
 * Wallets module definition - Web3 wallet operations and transactions
 */
export const walletsModule = defineModule({
  name: "wallets",
  prefix: "/wallets",
  routes: {
    // Basic wallet operations
    get: defineRoute<never, WalletsGetResponse>("GET", "/"),

    post: defineRoute<never, WalletsPostResponse>("POST", "/"),

    // Transaction operations (nested)
    transactions: {
      get: defineRoute<TransactionQuery, TransactionsGetResponse>(
        "GET",
        "/transactions",
      ),

      withdraw: defineRoute<WithdrawRequest, WithdrawResponse>(
        "POST",
        "/transactions/withdraw",
      ),
    },
  },
})

// Export the API type
export type WalletsAPI = typeof walletsModule.api

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