package logic

import (
	"context"

	"juwan-backend/app/dispute/rpc/internal/svc"
	"juwan-backend/app/dispute/rpc/pb"

	"github.com/zeromicro/go-zero/core/logx"
)

type DelDisputesLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDelDisputesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelDisputesLogic {
	return &DelDisputesLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *DelDisputesLogic) DelDisputes(in *pb.DelDisputesReq) (*pb.DelDisputesResp, error) {
	err := l.svcCtx.DisputeModelRW.Disputes.DeleteOneID(in.GetId()).Exec(l.ctx)
	if err != nil {
		logx.Errorf("delDisputes err: %v", err)
		return nil, err
	}

	return &pb.DelDisputesResp{}, nil
}
