from typing import Union,List
from inn import getEngine
import markdown
from sysjobs import *


def getHtml(sysjob: List[Union[Sysjobs,Sysjobhistory]]) -> str:
    resReturn: str=''
    resReturn = "# Title\n"
    resReturn+= "~~~mermaid\n"
    resReturn+= "gantt\n"
    #resReturn+= "dateFormat  YYYY-MM-DD H HH\n"
    for a in sysjob:
        resReturn+=a[0].name + ' : ' + str(a[1].getStartTime()) + ',' + str(a[1].getRunDurationInHourMinSec())+ '\n'
    resReturn+="​~~~"
    resReturn=markdown.markdown(resReturn, extensions=['md_mermaid'])    
    resReturn=resReturn.replace('<script>mermaid.initialize({startOnLoad:true});</script>','')
    return resReturn

def getJson(sysjob: List[Union[Sysjobs,Sysjobhistory]]):
    return ''