@indicafix/types
Version:
useful package for type sharing in different services.
89 lines (88 loc) • 2.15 kB
TypeScript
export interface Question {
id: string;
dataTitle: string;
dataDescription: string;
type: QuestionType;
text: string;
category: QuestionCategory;
isEditable: boolean;
isDeletable: boolean;
isRequired: boolean;
isPublic: boolean;
hasNAOption: boolean;
config: QuestionConfig;
status: QuestionStatus;
chartType: ChartType;
owner: string;
endAnswer: string[];
createdAt: Date;
updatedAt: Date;
__v: number;
}
export declare enum ChartType {
speedometer = "speedometer",
horizontalBar = "horizontalBar",
verticalBar = "verticalBar"
}
export declare enum QuestionCategory {
demographic = "demographic",
normal = "normal",
indicator = "indicator",
topic = "topic"
}
export declare enum QuestionType {
radio = "radio",
checkbox = "checkbox",
range = "range",
radioMatrix = "radioMatrix",
rangeMatrix = "rangeMatrix",
checkboxMatrix = "checkboxMatrix",
text = "text"
}
export declare enum QuestionStatus {
inactive = "inactive",
active = "active",
archived = "archived",
deleted = "deleted"
}
declare type OptionProps = {
value: string;
label: string;
};
declare type RadioConfig = {
allowOthers: boolean;
placeholder: string;
options: OptionProps[];
};
declare type CheckboxConfig = RadioConfig & {
maxNumberOfAnswer: number;
};
declare type RangeConfig = {
minText: string;
maxText: string;
minValue: number;
maxValue: number;
};
declare type RangeMatrixConfig = {
minText: string;
maxText: string;
minValue: number;
maxValue: number;
items: OptionProps[];
};
declare type RadioMatrixConfig = {
legend: string;
lines: OptionProps[];
columns: OptionProps[];
};
declare type CheckboxMatrixConfig = RadioMatrixConfig;
export declare enum TextSize {
short = "short",
long = "long"
}
declare type TextConfig = {
placeholder: string;
size: TextSize;
};
export declare type QuestionConfig = RadioConfig | CheckboxConfig | RangeConfig | RangeMatrixConfig | RadioMatrixConfig | CheckboxMatrixConfig | TextConfig;
export {};