// form/nc/nc-work-center/nc-work-center-button.js

let clickButton
export function setClickButton(clickButton_) {
	clickButton = clickButton_
}

function personStateStopButton(buttonAction) {
	// "v-on:click": "clickButton('run', 'stop')"
	// ":disabled": "!rec.current.can_run"
	// ":class": "'setup' === rec.current.unproductive ? 'active' : ''"
}

function personStateMaterialButton(buttonAction) {
	// "v-on:click": "clickButton('unproductive', 'material')"
	// ":disabled": "!rec.current.enterable"
	// ":class": "'material' === rec.current.unproductive ? 'active' : ''"
}

function personStateSetupButton(buttonAction) {
	// "v-on:click": "clickButton('unproductive', 'setup')"
	// ":disabled": "!rec.current.enterable"
	// ":class": "'setup' === rec.current.unproductive ? 'active' : ''"
}

function personStateWorkingButton(buttonAction) {
	// "v-on:click": "clickButton('run', 'start')"
	// ":disabled": "!rec.current.can_run"
	// ":class": "'start' === rec.person_state ? 'active' : ''"
}

function machineStateStopButton(buttonAction) {
	// "v-on:click": "clickButton('run', 'stop')"
	// ":disabled": "!rec.current.can_run"
	// ":class": "'stop' === rec.person_state ? 'active' : ''"
}

function machineStateMaterialButton(buttonAction) {
	// "v-on:click": "clickButton('unproductive', 'material')"
	// ":disabled": "!rec.current.enterable"
	// ":class": "'material' === rec.current.unproductive ? 'active' : ''"
}

function machineStateSetupButton(buttonAction) {
	// "v-on:click": "clickButton('unproductive', 'setup')"
	// ":disabled": "!rec.current.enterable"
	// ":class": "'setup' === rec.current.unproductive ? 'active' : ''"
}

function machineStateRunningButton(buttonAction) {
	// "v-on:click": "clickButton('run', 'start')"
	// ":disabled": "!rec.current.can_run",
	// ":class": "'start' === rec.person_state ? 'active' : ''"
	if (buttonAction === 'click') {
		return clickButton('run', 'start')
	}
	if (buttonAction === 'disabled') {
		return !rec.current.can_run
	}
	if (buttonAction === 'class') {
		return 'start' === rec.person_state ? 'active' : ''
	}
}

export function buttonAction(buttonId, buttonAction) {
	if (buttonId === 'person-state-stop') return personStateStopButton(buttonAction)
	if (buttonId === 'person-state-material') return personStateMaterialButton(buttonAction)
	if (buttonId === 'person-state-setup') return personStateSetupButton(buttonAction)
	if (buttonId === 'person-state-working') return personStateWorkingButton(buttonAction)
	if (buttonId === 'machine-state-stop') return machineStateStopButton(buttonAction)
	if (buttonId === 'machine-state-material') return machineStateMaterialButton(buttonAction)
	if (buttonId === 'machine-state-setup') return machineStateSetupButton(buttonAction)
	if (buttonId === 'machine-state-running') return machineStateRunningButton(buttonAction)
	// callEvent(buttonId, buttonAction)
}
