/**
 * 이 클래스는 camera 의 설정을 위한 에디터로 동작한다.
 */

import '../component/robot-arm-pose-list-input'
import '../component/robot-arm-controller'

import { html } from 'lit-element'

import { OxPropertyEditor } from '@operato/property-editor'

export class PoseProgramEditor extends OxPropertyEditor {
  static get styles() {
    return [...OxPropertyEditor.styles]
  }

  static get properties() {
    return {
      value: Object,
      host: Object
    }
  }

  editorTemplate(props) {
    var poses = (this.value instanceof Array ? this.value : []).map(pose => pose?.pose || {})
    var { connection } = this.host

    return html`
      <div fullwidth>
        <robot-arm-pose-list-input .value=${this.value} .connection=${connection}></robot-arm-pose-list-input>
        <robot-arm-controller .connection=${connection} .program=${poses}></robot-arm-controller>
      </div>
    `
  }
}

customElements.define('pose-program-editor', PoseProgramEditor)
