{{range .GenericPrefixes}}
object CheckCommand "{{.}}-checkcommand" {
	command = ["true"]
}

object EventCommand "{{.}}-eventcommand" {
	command = ["true"]
}

object NotificationCommand "{{.}}-notificationcommand" {
	command = ["true"]
}

object Endpoint "{{.}}-endpoint" {}

object Zone "{{.}}-zone" {
	parent = "master"
	endpoints = ["{{.}}-endpoint"]
}

object Host "{{.}}-host" {
	check_command = "hostalive"
}

object HostGroup "{{.}}-hostgroup" {}

object Service "{{.}}-service" {
	host_name = "{{.}}-host"
	check_command = "dummy"
}

object ServiceGroup "{{.}}-servicegroup" {}

object TimePeriod "{{.}}-timeperiod" {}

object User "{{.}}-user" {}

object UserGroup "{{.}}-usergroup" {}
{{end}}

{{range .NotificationUserGroups}}
object UserGroup "{{.}}" {
}
{{end}}

{{range $user, $groups := .NotificationUsers}}
object User "{{$user}}" {
  groups = [
    {{range $group, $_ := $groups}}
    "{{$group}}",
    {{end}}
  ]
}
{{end}}

object TimePeriod "workhours" {
    ranges = {}
}

object TimePeriod "never-ever" {
    ranges = {}
}

template Host "dependency-host-template" {
	check_command = "dummy"
	max_check_attempts = 1
	check_interval = 300s
	vars.dummy_text = "I'm just testing something"
	vars.dummy_state = 0
}

for (suffix in ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]) {
	object Host "Host"+suffix {
		import "dependency-host-template"
	}
}

{{range $dependencyGroups := .DependencyGroups}}
	{{range $dependencyGroup := .Groups}}
		{{range $parent := .Parents}}
			{{range $child := $dependencyGroup.Children}}
				object Dependency "dependency"+random() {
					parent_host_name = "{{$parent}}"
					child_host_name = "{{$child}}"
					ignore_soft_states = {{$dependencyGroup.IgnoreSoftStates}}
					states = [ {{NaturalJoin $dependencyGroup.StatesFilter ", "}} ]
					period = "{{$dependencyGroup.TimePeriod}}"
					redundancy_group = "{{$dependencyGroup.RedundancyGroupName}}"
				}
			{{end}}
		{{end}}
	{{end}}
{{end}}
