{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings manifest")}}
<h4 class="ui top attached header">
	{{ctx.Locale.Tr "repo.settings.manifest"}}
</h4>
<div class="ui attached segment">
	<p class="text grey">{{ctx.Locale.Tr "repo.settings.manifest_desc"}}</p>

	<form class="ui form" method="post" action="{{.RepoLink}}/settings/manifest">
		{{.CsrfTokenHtml}}

		<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.manifest_identity"}}</h5>
		<div class="two fields">
			<div class="field">
				{{if eq .Manifest.Platform "joomla"}}
					<label>{{ctx.Locale.Tr "repo.settings.manifest_element_name"}}</label>
					<input name="name" value="{{.Manifest.Name}}" placeholder="e.g. mokowaas">
					<p class="help">{{ctx.Locale.Tr "repo.settings.manifest_element_name_help"}}</p>
				{{else}}
					<label>{{ctx.Locale.Tr "repo.settings.manifest_name"}}</label>
					<input name="name" value="{{.Manifest.Name}}" placeholder="Project name">
				{{end}}
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_org"}}</label>
				<input name="org" value="{{.Manifest.Org}}" placeholder="Organization">
			</div>
		</div>
		<div class="four fields">
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_version"}}</label>
				<input name="version" value="{{.Manifest.Version}}" placeholder="e.g. 06.00.00">
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_version_prefix"}}</label>
				<input name="version_prefix" value="{{.Manifest.VersionPrefix}}" placeholder="e.g. v1.26.1-moko.">
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_license_spdx"}}</label>
				<input name="license_spdx" value="{{.Manifest.LicenseSPDX}}" placeholder="e.g. GPL-3.0-or-later">
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_license_name"}}</label>
				<input name="license_name" value="{{.Manifest.LicenseName}}" placeholder="e.g. GNU General Public License v3">
			</div>
		</div>

		<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.manifest_governance"}}</h5>
		<div class="three fields">
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_platform"}}</label>
				<select name="platform" class="ui dropdown">
					<option value="">—</option>
					{{$platform := .Manifest.Platform}}
					{{range $val := StringUtils.Split "joomla,wordpress,dolibarr,go,mcp,platform,generic" ","}}
						<option value="{{$val}}" {{if eq $val $platform}}selected{{end}}>{{$val}}</option>
					{{end}}
				</select>
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_standards_version"}}</label>
				<input name="standards_version" value="{{.Manifest.StandardsVersion}}" placeholder="e.g. 05.00.00">
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_standards_source"}}</label>
				<input name="standards_source" value="{{.Manifest.StandardsSource}}" placeholder="URL to standards repo">
			</div>
		</div>

		{{if or (eq .Manifest.Platform "joomla") (eq .Manifest.Platform "wordpress") (eq .Manifest.Platform "dolibarr")}}
		<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.manifest_distribution"}}</h5>
		<div class="two fields">
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_display_name"}}</label>
				<input name="display_name" value="{{.Manifest.DisplayName}}" placeholder="e.g. Package - MokoWaaS">
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_info_url"}}</label>
				<input name="info_url" value="{{.Manifest.InfoURL}}" placeholder="https://mokoconsulting.tech/product/...">
			</div>
		</div>
		<div class="two fields">
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_maintainer"}}</label>
				<input name="maintainer" value="{{.Manifest.Maintainer}}" placeholder="Moko Consulting">
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_maintainer_url"}}</label>
				<input name="maintainer_url" value="{{.Manifest.MaintainerURL}}" placeholder="https://mokoconsulting.tech">
			</div>
		</div>
		{{if or (eq .Manifest.Platform "joomla") (eq .Manifest.Platform "wordpress")}}
		<div class="two fields">
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_target_version"}}</label>
				<input name="target_version" value="{{.Manifest.TargetVersion}}" placeholder="e.g. (5|6)\..*">
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_php_minimum"}}</label>
				<input name="php_minimum" value="{{.Manifest.PHPMinimum}}" placeholder="e.g. 8.1">
			</div>
		</div>
		{{end}}
		{{end}}

		<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.manifest_build"}}</h5>
		<div class="three fields">
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_language"}}</label>
				<select name="language" class="ui dropdown">
					<option value="">—</option>
					{{$lang := .Manifest.Language}}
					{{range $val := StringUtils.Split "Go,PHP,TypeScript,JavaScript,Python,Ruby,Java,C#,Rust,Shell,SQL,CSS,HTML" ","}}
						<option value="{{$val}}" {{if eq $val $lang}}selected{{end}}>{{$val}}</option>
					{{end}}
				</select>
			</div>
			{{if eq .Manifest.Platform "joomla"}}
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_package_type"}}</label>
				<select name="package_type" class="ui dropdown">
					<option value="">—</option>
					{{$pkgType := .Manifest.PackageType}}
					{{range $val := StringUtils.Split "component,module,plugin,package,template,library,file" ","}}
						<option value="{{$val}}" {{if eq $val $pkgType}}selected{{end}}>{{$val}}</option>
					{{end}}
				</select>
				<p class="help">{{ctx.Locale.Tr "repo.settings.manifest_package_type_help"}}</p>
			</div>
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_element_full"}}</label>
				<input name="element_name" value="{{.Manifest.ElementName}}" placeholder="{{.Manifest.AutoElementName}}">
				{{if .Manifest.ElementNameMismatch}}
					<p class="help tw-text-yellow-600">{{ctx.Locale.Tr "repo.settings.manifest_element_mismatch" .Manifest.AutoElementName}}</p>
				{{else}}
					<p class="help">{{ctx.Locale.Tr "repo.settings.manifest_element_full_help"}}</p>
				{{end}}
			</div>
			{{end}}
			<div class="field">
				<label>{{ctx.Locale.Tr "repo.settings.manifest_entry_point"}}</label>
				<input name="entry_point" value="{{.Manifest.EntryPoint}}" placeholder="e.g. ./ or src/index.ts">
			</div>
		</div>

		<button class="ui primary button" type="submit">{{ctx.Locale.Tr "repo.settings.manifest_save"}}</button>
	</form>
</div>
{{template "repo/settings/layout_footer" .}}
