package router

import (
	"fonchain-fiee/pkg/middleware"
	"fonchain-fiee/pkg/service"
	serviceCustomerContract "fonchain-fiee/pkg/service/customerContract"

	"github.com/gin-gonic/gin"
)

// CustomerContractRouter 客户与合同管理路由，参考 MediaRouter 实现
func CustomerContractRouter(r *gin.RouterGroup) {
	auth := r.Group("")
	auth.Use(middleware.CheckWebLogin(service.AccountProvider))

	// 客户管理
	customer := auth.Group("customer")
	{
		customer.POST("list", serviceCustomerContract.GetCustomerList)
		customer.POST("detail", serviceCustomerContract.GetCustomerDetail)
		customer.POST("update", serviceCustomerContract.UpdateCustomer)
		customer.POST("list/referral-person", serviceCustomerContract.GetReferralPersonList)
	}

	// 合同管理
	contract := auth.Group("contract")
	{
		contract.POST("list", serviceCustomerContract.GetContractList)
		contract.POST("detail", serviceCustomerContract.GetContractDetail)
		contract.POST("update", serviceCustomerContract.UpdateContract)
		contract.POST("development-cycles", serviceCustomerContract.GetDevelopmentCyclesByContractUUID)
		contract.POST("payment-cycles", serviceCustomerContract.GetPaymentCyclesByContractUUID)
		contract.POST("upload-attachment", serviceCustomerContract.UploadContractAttachment)
	}
}
