#!/usr/bin/env python3

import sys
import argparse
import pathlib
sys.path.insert(0, str((pathlib.Path(__file__) / '..').resolve()))
from webserver import server
from base import Client
from dummy import DummyGraph, DummyHistory
from secop import SecopInteractor


def parseArgv(argv):
    parser = argparse.ArgumentParser(
        description="start webserver with dummy history and SECoP interaction",
    )
    parser.add_argument("port",
                        type=str,
                        default='8888',
                        nargs='?',
                        help="port number to serve")
    parser.add_argument('-u',
                        '--uri',
                        action='store',
                        help='SECoP uri',
                        default='localhost:5000')
    return parser.parse_args(argv)


args = parseArgv(sys.argv[1:])

server.run(int(args.port), DummyHistory(args.uri), DummyGraph, Client, single_instrument='dummy', secop=SecopInteractor)
