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

type ExecutionType = "automatic" | "interaction";

type OnRunProps = OnRunProps$1;
/**
 * The function that is called when the class is runned.
 */
type OnRunEvent<T> = (item: T, props: OnRunProps) => any | Promise<any>;
type OnRunFunction = (props: OnRunProps) => any | Promise<any>;
type OnRunAsyncFunction = (props: OnRunProps) => Promise<any>;

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 started and not completed and not failed.
     */
    readonly inProgress: 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?: OnRunEvent<QuestInterface>;
    /**
     * The function that will be called when the quest goes to the next stage.
     */
    readonly onNextStage?: OnRunEvent<QuestInterface>;
    /**
     * 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$1): Promise<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$1): Promise<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$1): Promise<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$1): Promise<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$1): Promise<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?: OnRunEvent<StageInterface>;
    /**
     * The function that will be called when the stage ends.
     */
    readonly onEnd?: OnRunEvent<StageInterface>;
    /**
     * 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) => storage.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 date when the stage starts.
     */
    readonly startDate?: number;
    /**
     * Check if the stage can start.
     * @example
     * ```ts
     * export default class Stage extends StageStoredClass {
     * 	override get canStart(): boolean {
     * 		if (this.flagsRequired.length > 0 && !this.flagsRequired.every((flag) => storage.getFlag(flag.flag))) {
     * 			return false;
     * 		}
     * 		return super.canStart;
     * 	}
     * }
     * ```
     */
    readonly canStart: boolean;
    /**
     * The function that will be called when the stage starts.
     */
    start(props: OnRunProps$1): Promise<void>;
    /**
     * The number of day/date required to start the stage.
     */
    readonly deltaDateRequired: number;
    /**
     * The list of quests required to start the stage.
     */
    readonly questsRequired: QuestsRequiredType[];
}

export type { ExecutionType as E, OnRunAsyncFunction as O, QuestInterface as Q, StageInterface as S, OnRunEvent as a, OnRunFunction as b, OnRunProps as c, QuestsRequiredType as d, QuestBaseInternalInterface as e, StageBaseInternalInterface as f };
