package threads_account

import (
	"context"

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

type DeletePublishQueueItemLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewDeletePublishQueueItemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeletePublishQueueItemLogic {
	return &DeletePublishQueueItemLogic{ctx: ctx, svcCtx: svcCtx}
}

func (l *DeletePublishQueueItemLogic) DeletePublishQueueItem(req *types.PublishQueueItemPath) error {
	tenantID, uid, err := actorFrom(l.ctx)
	if err != nil {
		return err
	}
	return l.svcCtx.PublishQueue.Delete(l.ctx, tenantID, uid, req.ID, req.QID)
}
