// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1

package placement_topic

import (
	"context"

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

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

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

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

func (l *DeletePlacementTopicScanPostLogic) DeletePlacementTopicScanPost(req *types.DeletePlacementTopicScanPostHandlerReq) error {
	tenantID, uid, err := actorFrom(l.ctx)
	if err != nil {
		return err
	}
	scope, err := resolveScope(l.ctx, l.svcCtx, tenantID, uid, req.ID)
	if err != nil {
		return err
	}
	return l.svcCtx.ScanPost.Delete(l.ctx, tenantID, uid, scope.BrandID, scope.TopicID, req.PostID)
}
