package controller

import (
	"context"
	"fmt"

	"github.com/fonchain/fonchain-artistinfo/cmd/internal/logic"
	"github.com/fonchain/fonchain-artistinfo/pb/artistinfo"
)

type ArtistInfoProvider struct {
	artistinfo.UnimplementedArtistInfoServer
	artistInfoLogic *logic.ArtistInfo
}

func (a *ArtistInfoProvider) RegisterUser(ctx context.Context, req *artistinfo.RegisterUserRequest) (rep *artistinfo.RegisterUserRespond, err error) {
	fmt.Println("第一处")
	// backup := &artistInfo.GetUserInfoRespond{}
	if rep, err = a.artistInfoLogic.RegisterUser(req); err != nil {
		return nil, err
	}
	return rep, nil
}

func (a *ArtistInfoProvider) GetUser(ctx context.Context, req *artistinfo.GetUserRequest) (rep *artistinfo.GetUserRespond, err error) {
	fmt.Println("第一处")
	// backup := &artistInfo.GetUserInfoRespond{}
	if rep, err = a.artistInfoLogic.GetUser(req); err != nil {
		return nil, err
	}
	return rep, nil
}

func (a *ArtistInfoProvider) UpdateRealName(ctx context.Context, req *artistinfo.UpdateRealNameRequest) (rep *artistinfo.UpdateRealNameRespond, err error) {
	fmt.Println("第一处")
	// backup := &artistInfo.GetUserInfoRespond{}
	if rep, err = a.artistInfoLogic.UpdateRealName(req); err != nil {
		return nil, err
	}
	return rep, nil
}

func (a *ArtistInfoProvider) FinishVerify(ctx context.Context, req *artistinfo.FinishVerifyRequest) (rep *artistinfo.FinishVerifyRespond, err error) {
	fmt.Println("第一处")
	// backup := &artistInfo.GetUserInfoRespond{}
	if rep, err = a.artistInfoLogic.FinishVerify(req); err != nil {
		return nil, err
	}
	return rep, nil
}

func (a *ArtistInfoProvider) CheckUserLock(ctx context.Context, req *artistinfo.CheckUserLockRequest) (rep *artistinfo.CheckUserLockRespond, err error) {
	fmt.Println("第一处")
	// backup := &artistInfo.GetUserInfoRespond{}
	if rep, err = a.artistInfoLogic.CheckUserLock(req); err != nil {
		return nil, err
	}
	return rep, nil
}

func (a *ArtistInfoProvider) ArtistSupplyList(ctx context.Context, req *artistinfo.ArtistSupplyListRequest) (rep *artistinfo.ArtistSupplyListRespond, err error) {
	fmt.Println("第一处")
	// backup := &artistInfo.GetUserInfoRespond{}
	if rep, err = a.artistInfoLogic.ArtistSupplyList(req); err != nil {
		return nil, err
	}
	return rep, nil
}
