package routes

import (
	"github.com/gofiber/fiber/v2"

	"github.com/break/junhong_cmp_fiber/internal/handler/admin"
	"github.com/break/junhong_cmp_fiber/internal/model/dto"
	"github.com/break/junhong_cmp_fiber/pkg/openapi"
)

func registerMyCommissionRoutes(router fiber.Router, handler *admin.MyCommissionHandler, doc *openapi.Generator, basePath string) {
	my := router.Group("/my")
	groupPath := basePath + "/my"

	Register(my, doc, groupPath, "GET", "/commission-summary", handler.GetSummary, RouteSpec{
		Summary: "我的佣金概览",
		Tags:    []string{"我的佣金"},
		Input:   nil,
		Output:  new(dto.MyCommissionSummaryResp),
		Auth:    true,
	})

	Register(my, doc, groupPath, "POST", "/withdrawal-requests", handler.CreateWithdrawal, RouteSpec{
		Summary: "发起提现申请",
		Tags:    []string{"我的佣金"},
		Input:   new(dto.CreateMyWithdrawalReq),
		Output:  new(dto.CreateMyWithdrawalResp),
		Auth:    true,
	})

	Register(my, doc, groupPath, "GET", "/withdrawal-requests", handler.ListWithdrawals, RouteSpec{
		Summary: "我的提现记录",
		Tags:    []string{"我的佣金"},
		Input:   new(dto.MyWithdrawalListReq),
		Output:  new(dto.WithdrawalRequestPageResult),
		Auth:    true,
	})

	Register(my, doc, groupPath, "GET", "/commission-records", handler.ListRecords, RouteSpec{
		Summary: "我的佣金明细",
		Tags:    []string{"我的佣金"},
		Input:   new(dto.MyCommissionRecordListReq),
		Output:  new(dto.MyCommissionRecordPageResult),
		Auth:    true,
	})

	Register(my, doc, groupPath, "GET", "/commission-stats", handler.GetStats, RouteSpec{
		Summary: "我的佣金统计",
		Tags:    []string{"我的佣金"},
		Input:   new(dto.CommissionStatsRequest),
		Output:  new(dto.CommissionStatsResponse),
		Auth:    true,
	})

	Register(my, doc, groupPath, "GET", "/commission-daily-stats", handler.GetDailyStats, RouteSpec{
		Summary: "我的每日佣金统计",
		Tags:    []string{"我的佣金"},
		Input:   new(dto.DailyCommissionStatsRequest),
		Output:  []dto.DailyCommissionStatsResponse{},
		Auth:    true,
	})
}
