import { POLL_KIND, POLL_RESPONSE_KIND } from "applesauce-core/helpers";
import { blueprint } from "../event-factory.js";
import { setMetaTags } from "../operations/common.js";
import { setContent } from "../operations/content.js";
import { setZapSplit } from "../operations/zap-split.js";
import { PollResponse, Poll } from "../operations/index.js";
/**
 * NIP-88 Poll event (kind 1068) blueprint
 * Creates a poll event with question and options
 */
export function PollBlueprint(question, options, opts) {
    return blueprint(POLL_KIND, Poll.setQuestion(question), Poll.setOptions(options), opts?.pollType ? Poll.setType(opts.pollType) : undefined, opts?.endsAt ? Poll.setEndsAt(opts.endsAt) : undefined, opts?.relays ? Poll.setRelays(opts.relays) : undefined, setZapSplit(opts), setMetaTags({ ...opts, alt: opts?.alt ?? `Poll: ${question}` }));
}
/**
 * NIP-88 Poll Response event (kind 1018) blueprint
 * Creates a response to a poll event
 */
export function PollResponseBlueprint(poll, optionIds, opts) {
    return blueprint(POLL_RESPONSE_KIND, PollResponse.setPollEvent(poll), PollResponse.setChoices(optionIds), opts?.comment ? setContent(opts.comment) : undefined, setMetaTags({ ...opts, alt: opts?.alt ?? "Poll response" }));
}
/**
 * Convenience blueprint for single-choice poll responses
 * Creates a response to a poll event with a single option
 */
export function SingleChoicePollResponseBlueprint(poll, optionId, opts) {
    return blueprint(POLL_RESPONSE_KIND, PollResponse.setPollEvent(poll), PollResponse.setChoice(optionId), opts?.comment ? setContent(opts.comment) : undefined, setMetaTags({ ...opts, alt: opts?.alt ?? "Poll response" }));
}
