import { OnRunProps, QuestInterface as QuestInterface$1, StageInterface as StageInterface$1 } from '@drincs/nqtr';

type QuestsRequiredType = {
    quest: QuestInterface;
    stageNumber: number;
};

interface QuestInterface extends QuestBaseInternalInterface, QuestInterface$1 {
}
interface QuestBaseInternalInterface {
    /**
     * The id of the quest.
     */
    readonly id: string;
    /**
     * The stages of the quest.
     */
    readonly stages: StageInterface[];
    /**
     * The index of the current stage.
     */
    currentStageIndex?: number;
    /**
     * The current stage.
     */
    readonly currentStage?: StageInterface;
    /**
     * If the quest is started.
     */
    readonly started: boolean;
    /**
     * If the quest is completed.
     */
    readonly completed: boolean;
    /**
     * If the quest is failed.
     */
    readonly failed: boolean;
    /**
     * The function that will be called when the quest starts.
     */
    readonly onStart?: (stage: QuestInterface, props: OnRunProps) => void;
    /**
     * The function that will be called when the quest goes to the next stage.
     */
    readonly onNextStage?: (stage: QuestInterface, props: OnRunProps) => void;
    /**
     * Start the quest.
     * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
     * @returns
     */
    start(props: OnRunProps): void;
    /**
     * Go to the next stage if the current stage is completed.
     * If you want to force the change of stage, use goNextStage.
     * @param props The properties. If you not want to pass any property, you can pass an {}.
     * @returns true if the stage was changed, false otherwise.
     */
    tryToGoNextStage(props: OnRunProps): boolean;
    /**
     * Complete the current stage and go to the next stage.
     * If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
     * @param props The properties. If you not want to pass any property, you can pass an {}.
     * @returns true if the stage was changed, false otherwise.
     */
    completeCurrentStageAndGoNext(props: OnRunProps): boolean;
    /**
     * Go to the next stage without checking if the current stage is completed.
     * If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
     * @param props The properties. If you not want to pass any property, you can pass an {}.
     * @returns returns true if the stage was changed, false otherwise.
     */
    goNextStage(props: OnRunProps): boolean;
    /**
     * If the current stage must start. It is true if the current stage is not started, can start and not completed.
     */
    readonly currentStageMustStart: boolean;
    /**
     * Start the current stage.
     * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
     */
    startCurrentStage(props: OnRunProps): void;
}

interface StageInterface extends StageBaseInternalInterface, StageInterface$1 {
}
interface StageBaseInternalInterface {
    /**
     * The id of the stage.
     */
    readonly id: string;
    /**
     * The function that will be called when the stage starts.
     */
    readonly onStart?: (stage: StageInterface, props: OnRunProps) => void;
    /**
     * The function that will be called when the stage ends.
     */
    readonly onEnd?: (stage: StageInterface, props: OnRunProps) => void;
    /**
     * Check if the flag and goals are completed.
     * You can force the completion of the stage by setting the completed property to true.
     * @example
     * ```ts
     * export default class Stage extends StageStoredClass {
     * 	override get completed(): boolean {
     * 		if (super.completed) {
     * 			return true;
     * 		}
     * 		if (this.flags.length > 0) {
     * 			if (!this.flags.every((flag) => getFlag(flag.flag))) {
     * 				return false;
     * 			}
     * 			return true;
     * 		}
     * 		return false;
     * 	}
     * 	override set completed(value: boolean) {
     * 		super.completed = value;
     * 	}
     * }
     * ```
     */
    completed: boolean;
    /**
     * If the stage is started.
     */
    started: boolean;
    /**
     * The day when the stage starts.
     */
    readonly startDay?: number;
    /**
     * Check if the stage can start.
     * @example
     * ```ts
     * export default class Stage extends StageStoredClass {
     * 	override get canStart(): boolean {
     * 		if (this.flagsRequiredToStart.length > 0 && !this.flagsRequiredToStart.every((flag) => getFlag(flag.flag))) {
     * 			return false;
     * 		}
     * 		return super.canStart;
     * 	}
     * }
     * ```
     */
    readonly canStart: boolean;
    /**
     * The function that will be called when the stage starts.
     */
    start(props: OnRunProps): void;
    /**
     * The number of days required to start the stage.
     */
    readonly daysRequiredToStart: number;
    /**
     * The list of quests required to start the stage.
     */
    readonly questsRequiredToStart: QuestsRequiredType[];
}

export type { QuestInterface as Q, StageInterface as S, QuestsRequiredType as a, QuestBaseInternalInterface as b, StageBaseInternalInterface as c };
