9872fb8a54
Co-authored-by: Filip Hejmowski <fhejmowski@simplito.com> Co-authored-by: neriousy <hejmowskifilip@gmail.com> Co-authored-by: Kit Langton <kit.langton@gmail.com>
23 lines
971 B
TypeScript
23 lines
971 B
TypeScript
export * as Question from "./question.js"
|
|
|
|
import { Schema } from "effect"
|
|
import { optional } from "./schema.js"
|
|
|
|
const Option = Schema.Struct({
|
|
label: Schema.String.annotate({ description: "Display text (1-5 words, concise)" }),
|
|
description: Schema.String.annotate({ description: "Explanation of choice" }),
|
|
})
|
|
|
|
const base = {
|
|
question: Schema.String.annotate({ description: "Complete question" }),
|
|
header: Schema.String.annotate({ description: "Very short label (max 30 chars)" }),
|
|
options: Schema.Array(Option).annotate({ description: "Available choices" }),
|
|
multiple: Schema.Boolean.pipe(optional).annotate({ description: "Allow selecting multiple choices" }),
|
|
}
|
|
|
|
export const Prompt = Schema.Struct(base).annotate({ identifier: "Question.Prompt" })
|
|
export interface Prompt extends Schema.Schema.Type<typeof Prompt> {}
|
|
|
|
export const Answer = Schema.Array(Schema.String).annotate({ identifier: "Question.Answer" })
|
|
export type Answer = typeof Answer.Type
|