package controller

import (
	"context"
	"fmt"

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

type ContractProvider struct {
	contract.UnimplementedContractServer
	contractLogic *logic.Contract
}

func (c *ContractProvider) CreateContract(ctx context.Context, req *contract.CreateContractRequest) (rep *contract.CreateContractRespond, err error) {
	fmt.Println("第一处")
	if rep, err = c.contractLogic.CreateContract(req); err != nil {
		return nil, err
	}
	return rep, nil
}

func (c *ContractProvider) ContractListMgmt(ctx context.Context, req *contract.ContractListMgmtRequest) (rep *contract.ContractListMgmtRespond, err error) {
	fmt.Println("第一处")
	if rep, err = c.contractLogic.ContractListMgmt(req); err != nil {
		return nil, err
	}
	return rep, nil
}

func (c *ContractProvider) ContractList(ctx context.Context, req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
	fmt.Println("第一处")
	if rep, err = c.contractLogic.ContractList(req); err != nil {
		return nil, err
	}
	return rep, nil
}

func (c *ContractProvider) SignContract(ctx context.Context, req *contract.SignContractRequest) (rep *contract.SignContractRespond, err error) {
	fmt.Println("第一处")
	if rep, err = c.contractLogic.SignContract(req); err != nil {
		return nil, err
	}
	return rep, nil
}

// func (c *ContractProvider) FinishContract(ctx context.Context, req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error) {
// 	fmt.Println("第一处")
// 	if rep, err = c.contractLogic.FinishContract(req); err != nil {
// 		return nil, err
// 	}
// 	return rep, nil
// }

// func (c *ContractProvider) ContractList(ctx context.Context, req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
// 	fmt.Println("第一处")
// 	if rep, err = c.contractLogic.ContractList(req); err != nil {
// 		return nil, err
// 	}
// 	return rep, nil
// }
// func (c *ContractProvider) GetContract(ctx context.Context, req *contract.GetContractRequest) (rep *contract.ContractData, err error) {
// 	fmt.Println("第一处")
// 	if rep, err = c.contractLogic.GetContract(req); err != nil {
// 		return nil, err
// 	}
// 	return rep, nil
// }
// func (c *ContractProvider) ContractTxList(ctx context.Context, req *contract.ContractTxListRequest) (rep *contract.ContractTxListRespond, err error) {
// 	fmt.Println("第一处")
// 	if rep, err = c.contractLogic.ContractTxList(req); err != nil {
// 		return nil, err
// 	}
// 	return rep, nil
// }

// func (c *ContractProvider) UpdateContract(ctx context.Context, req *contract.UpdateContractRequest) (rep *contract.UpdateContractRespond, err error) {
// 	fmt.Println("第一处")
// 	if rep, err = c.contractLogic.UpdateContract(req); err != nil {
// 		return nil, err
// 	}
// 	return rep, nil
// }
// func (c *ContractProvider) UpdateContractTx(ctx context.Context, req *contract.UpdateContractTxRequest) (rep *contract.UpdateContractTxRespond, err error) {
// 	fmt.Println("第一处")
// 	if rep, err = c.contractLogic.UpdateContractTx(req); err != nil {
// 		return nil, err
// 	}
// 	return rep, nil
// }
