package placement_topic

import (
	"context"

	"haixun-backend/internal/svc"
	"haixun-backend/internal/types"

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

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

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

func (l *DeletePlacementTopicLogic) DeletePlacementTopic(req *types.PlacementTopicPath) error {
	tenantID, uid, err := actorFrom(l.ctx)
	if err != nil {
		return err
	}
	return l.svcCtx.PlacementTopic.Delete(l.ctx, tenantID, uid, req.ID)
}
