import { makeAutoObservable } from 'mobx'

export class ActivationStore {
	static singleton: ActivationStore | null = null

	static instance() {
		if (!ActivationStore.singleton) {
			ActivationStore.singleton = new ActivationStore()
		}
		return ActivationStore.singleton
	}

	constructor() {
		makeAutoObservable(this)
	}

	shouldCreateAccount = true

	setShouldCreateAccount(shouldCreateAccount: boolean) {
		this.shouldCreateAccount = shouldCreateAccount
	}

	code: string = '';

	setCode(code: string) {
		this.code = code
	}

	step: number = 0

	get stepItems(): Array<{ title: string }> {
		return (this.shouldCreateAccount ? [{
			title: 'Account',
		}] : []).concat([{
			title: 'Tester Info',
		},
			{
				title: 'Review'
			},
			{
				title: 'Done'
			}])
	}

	handlePrev() {
		if (this.step === 0) return
		this.step = this.step - 1
		console.log('step', this.step)
	}

	handleNext() {
		if (this.step === this.stepItems.length - 1) return
		this.step = this.step + 1
		console.log('step', this.step)
	}

	testerInfo: any = {}

	setTesterInfo(testerInfo: any) {
		this.testerInfo = testerInfo

	}

}
