summaryrefslogtreecommitdiffstats
path: root/pkg/icingadb/v1/overdue/service.go
blob: dfd5383ccfbedad18307e666360ae97aa19ab874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package overdue

import (
	"github.com/icinga/icingadb/pkg/contracts"
	v1 "github.com/icinga/icingadb/pkg/icingadb/v1"
	"github.com/icinga/icingadb/pkg/types"
)

type ServiceState struct {
	v1.EntityWithoutChecksum
	IsOverdue types.Bool `json:"is_overdue"`
}

func NewServiceState(id string, overdue bool) (contracts.Entity, error) {
	hs := &ServiceState{IsOverdue: types.Bool{
		Bool:  overdue,
		Valid: true,
	}}

	return hs, hs.Id.UnmarshalText([]byte(id))
}

// Assert interface compliance.
var (
	_ contracts.Entity = (*ServiceState)(nil)
)