



#from apoplast.organisms.monetary.clique import clique as monetary_clique
#from apoplast.organisms.customs.clique import clique as customs_clique
#from apoplast.organisms.sanique.clique import clique as sanic_clique

#import apoplast._ops.on as apoplast_on
#import apoplast._ops.off as apoplast_off
#import apoplast._ops.status as apoplast_status

#from apoplast._essence import prepare_essence_from_py_file

import somatic

import os
import json
import time
import pathlib
from os.path import dirname, join, normpath
import sys

import rich
import click

this_directory = pathlib.Path (__file__).parent.resolve ()	

def clique ():
	'''
		Check for essence here and then set them 
		implicitly.
	'''
	print ('essence check')


	@click.group ()
	def group ():
		pass

	@click.command ("help")
	def help ():	
		the_mix = str (normpath (join (this_directory, "../..")))
		
		somatic.start ({
			"directory": the_mix,
			"relative path": the_mix,
			"port": 20000,
			"static port": False,
			"verbose": 1
		})

		import time
		while True:
			time.sleep (1000)
	
	'''
	#
	#	apoplast on --essence-path apoplast.JSON
	#
	@click.command ("on")
	@click.option (
		'--essence-path', 
		default = 'essence.py',
		help = 'apoplast on --essence-path essence.py', 
		required = False
	)
	def on (essence_path):	
		apoplast_essence = prepare_essence_from_py_file (essence_path)
	
		apoplast_on.on (apoplast_essence)
		time.sleep (2)
		print ('on')
		
	@click.command ("off")
	@click.option (
		'--essence-path', 
		default = 'essence.py',
		help = 'apoplast off --essence-path essence.py', 
		required = False
	)
	def off (essence_path):
		apoplast_off.off (essence_path)
		time.sleep (2)
		print ('off')
		
	@click.command ("status")
	@click.option (
		'--essence-path', 
		default = 'essence.py',
		help = 'apoplast off --essence-path essence.py', 
		required = False
	)
	def status (essence_path):
		apoplast_status.status (essence_path)
		time.sleep (2)

		
	

	group.add_command (on)
	group.add_command (off)
	group.add_command (status)
	'''
	
	group.add_command (help)
		
	#group.add_command (monetary_clique ())
	#group.add_command (sanic_clique ())
	#group.add_command (customs_clique ())
	
	group ()




#
