package api

import (
	"gadmin/internal/admin/forms"
	"gadmin/internal/admin/service"
	"github.com/gin-gonic/gin"
)

func MigrateUserInfo(ctx *gin.Context) {
	var req forms.MigrateUserInfoReq
	if err := ctx.ShouldBind(&req); err != nil {
		ctx.JSON(200, ErrorResponse(err))
		return
	}

	if err := forms.ParseParams(&req); err != nil {
		ctx.JSON(200, ErrorResponse(err))
		return
	}

	ctx.JSON(200, service.UserAccount.Get(ctx, forms.UserAccountGetReq{
		ID: req.PlayerId,
	}))
}

func MigrateComplete(ctx *gin.Context) {
	var req forms.MigrateCompleteReq
	if err := ctx.ShouldBind(&req); err != nil {
		ctx.JSON(200, ErrorResponse(err))
		return
	}

	if err := forms.ParseParams(&req); err != nil {
		ctx.JSON(200, ErrorResponse(err))
		return
	}

	ctx.JSON(200, service.UserAccount.MigrateComplete(ctx, req))
}
