{{~it.tibia.lv2.prefixes :p}}
@prefix {{=p.id}}: <{{=p.uri}}> .
{{~}}

{{~it.product.parameters :p}}
plugin:{{=p.id}}
	a lv2:Parameter ;
	rdfs:label "{{=p.name}}" ;
	lv2:name "{{=p.name}}" ;
{{?"shortName" in p}}
	lv2:shortName "{{=p.shortName.substring(0, 16)}}" ;
{{?}}
	lv2:symbol "{{=p.id}}" ;
	rdfs:range atom:Float .
{{~}}

{{=it.tibia.lv2.ttlURI(it.lv2.uri)}}
	a lv2:Plugin ;
{{~it.lv2.types :t}}
	a {{=it.tibia.lv2.ttlURI(t)}} ;
{{~}}
{{?it.lv2.project}}
	lv2:project {{=it.tibia.lv2.ttlURI(it.lv2.project)}} ;
{{?}}
	lv2:binary <{{=it.product.bundleName}}@DLL_SUFFIX@> ;
	doap:name "{{=it.product.name}}" ;
	doap:maintainer [
		a foaf:Organization ;
		foaf:name "{{=it.company.name}}" ;
		foaf:mbox <mailto:{{=it.company.email}}> ;
		rdfs:seeAlso {{=it.tibia.lv2.ttlURI(it.company.url)}}
	] ;
	lv2:minorVersion {{=/^([0-9]+)\./.exec(it.lv2.version)[1]}} ;
	lv2:microVersion {{=/^[0-9]+\.([0-9]+)/.exec(it.lv2.version)[1]}} ;
{{?it.tibia.lv2.ports.find(p => p.type == "midi" || p.type == "param")}}
	lv2:requiredFeature urid:map ;
	lv2:optionalFeature log:log ;
{{?}}
{{?it.product.parameters.find(p => p.direction == "input")}}
	patch:writable {{=it.product.parameters.filter(p => p.direction == "input").map(p => "plugin:" + p.id).join(" , ")}} ;
{{?}}
{{?it.product.parameters.find(p => p.direction == "output")}}
	patch:readable {{=it.product.parameters.filter(p => p.direction == "output").map(p => "plugin:" + p.id).join(" , ")}} ;
{{?}}
	lv2:optionalFeature lv2:hardRTCapable ;
{{?it.product.ui}}
	ui:ui plugin:ui ;
{{?}}
	lv2:port [
{{~it.tibia.lv2.ports :p:i}}
		a {{?p.type == "control"}}lv2:ControlPort{{??(p.type == "midi" || p.type == "param")}}atom:AtomPort{{??}}{{?p.cv}}lv2:CVPort{{??}}lv2:AudioPort{{?}}{{?}} ,
			{{?p.direction == "input"}}lv2:InputPort{{??}}lv2:OutputPort{{?}} ;
		lv2:name "{{=p.name}}" ;
{{?"shortName" in p}}
		lv2:shortName "{{=p.shortName.substring(0, 16)}}" ;
{{?}}
		lv2:symbol "{{=p.id}}" ;
{{?p.type == "param"}}
		atom:bufferType atom:Sequence ;
		atom:supports atom:Object ;
		atom:supports patch:Message ;
{{??p.type == "midi"}}
		atom:bufferType atom:Sequence ;
		atom:supports midi:MidiEvent ;
{{?}}
{{?p.sidechain}}
		lv2:portProperty lv2:isSideChain ;
{{?}}
{{?p.control}}
		lv2:designation lv2:control ;
{{?}}
{{?p.optional}}
		lv2:portProperty lv2:connectionOptional ;
{{?}}
		lv2:index {{=i}}
{{?i < it.tibia.lv2.ports.length - 1}}
	] , [
{{??}}
	] .
{{?}}
{{~}}

{{?it.product.ui}}
plugin:ui
	a ui:@UI_TYPE@ ;
	ui:binary <{{=it.product.bundleName}}@DLL_SUFFIX@> ;
{{?!it.product.ui.userResizable}}
	lv2:optionalFeature ui:noUserResize ; # doesn't work as lv2:requiredFeature, don't ask me why
{{?!it.product.ui.selfResizable}}
	lv2:optionalFeature ui:fixedSize ;
{{?}}
{{?}}
	lv2:requiredFeature ui:idleInterface ;
	lv2:extensionData ui:idleInterface .
{{?}}