class CreateSimView extends WindozDomContent {

    constructor() {
        super()
        Object.assign(this, app.helpers.activeAttributes, app.helpers.basicDialogs)
    }

    async DOMContentLoaded(options) {
        this.models = options.models
        const components = ui.eicfy(this.el)
        this.setupRefs(components)

        this.models.keyframes.list('', null).then(data => data.payload).then(kflist => {
            this.outputs.keyframesSelector.fillOptions(kflist.map(item => {
                return({
                    markup: item.ekf_name,
                    value: item.ekf_uuid
                })
            }))
        })
        this.outputs.keyframesSelector.addEventListener('change', this.onChangeKeyframe.bind(this))
    }

    onChangeKeyframe(event) {
        if(!this.outputs.keyframesSelector.value) return
        // TODO: use selected keyframe for simulation creation
    }
}

app.registerClass('CreateSimView', CreateSimView)
