<script setup lang="ts">
import TheModeler from './components/TheModeler.vue'
import TheDetail from './components/TheDetail.vue'
import TheParent from './components/TheParent.vue'
import TheEditor from './components/TheEditor.vue'
import TheDynamics from './components/TheDynamics.vue'
import { ServerConfig } from '@/util/sconfig'


import TheModels from './components/TheModels.vue'
import { useStore } from './util/store';
import { AddressSpace } from './ua/AddressSpace';
import { assert } from './util/assert';

async function load(): Promise<AddressSpace> {
    const files=['nodesets/Opc.Ua.NodeSet2.xml',
               'nodesets/Opc.Ua.Di.NodeSet2.xml',
               'nodesets/Opc.Ua.Ia.NodeSet2.xml',
               'nodesets/Opc.Ua.Machinery.NodeSet2.xml',
               'nodesets/Opc.Ua.MachineTool.Nodeset2.xml',
               'nodesets/emco_machine_tools.xml']
    const as=await AddressSpace.load(files);
    return as;
  }

  const loadData = async () => {
    const store = useStore();
    store.sConfig = new ServerConfig();
    store.addressSpace=await load();
    assert(store.addressSpace)
    const rootNode=store.addressSpace.findNode("ns=0;i=84");
    assert(rootNode)
    store.rootNode=rootNode;
  }
  loadData();
</script>

<template>
  <div class="container text-left">
    <div class="row align-items-start">
      <div class="col col-6">
        
        <TheModels />
        <TheModeler />
        
      </div>
      <div class="col col-6">
        <TheParent />
        <TheDetail />
        <TheEditor />
        <TheDynamics />

      </div>
    </div>
  </div>
</template>

<style>

</style>