package search

import (
	xsd "module git.kingecg.top/kingecg/goonvif/onvif/xsd"
	onvifmodel "git.kingecg.top/kingecg/goonvif/onvif/xsd/onvif"
)

type SourceReference onvifmodel.ReferenceToken
type RecordingReference onvifmodel.ReferenceToken

type SearchScope struct {
	IncludedSources            []SourceReference    `xml:"onvif:IncludedSources"`
	IncludedRecordings         []RecordingReference `xml:"onvif:IncludedRecordings"`
	RecordingInformationFilter xsd.String           `xml:"onvif:RecordingInformationFilter"`
	Extension                  SearchScopeExtension `xml:"onvif:Extension"`
}

type SearchScopeExtension []xsd.AnyType

type FindRecordings struct {
	XMLName          string       `xml:"tse:FindRecordings"`
	Scope            SearchScope  `xml:"tse:Scope"`
	MaxMatches       xsd.Int      `xml:"tse:MaxMatches"`
	KeepAliveTimeout xsd.Duration `xml:"tse:KeepAliveTimeout"`
}
type FindRecordingsResponse struct {
	SearchToken onvifmodel.ReferenceToken
}

type GetRecordingSummary struct {
	XMLName string `xml:"tse:GetRecordingSummary"`
}

type RecordingSummary struct {
	DataFrom         xsd.DateTime
	DataUntil        xsd.DateTime
	NumberRecordings xsd.Int
}
type GetRecordingSummaryResponse struct {
	Summary RecordingSummary
}

type GetRecordingSearchResults struct {
	XMLName     string                    `xml:"tse:GetRecordingSearchResults"`
	SearchToken onvifmodel.ReferenceToken `xml:"tse:SearchToken"`
	MinResults  xsd.Int                   `xml:"tse:MinResults"`
	MaxResults  xsd.Int                   `xml:"tse:MaxResults"`
	WaitTime    xsd.Duration              `xml:"tse:WaitTime"`
}

type RecordingSourceInformation struct {
	SourceId    xsd.AnyURI
	Name        xsd.String
	Location    xsd.String
	Description xsd.String
	Address     xsd.AnyURI
}

type TrackInformation struct {
	TrackToken  onvifmodel.ReferenceToken
	TrackType   xsd.String
	Description xsd.String
	DataFrom    xsd.DateTime
	DataTo      xsd.DateTime
}
type RecordingInformation struct {
	RecordingToken    onvifmodel.ReferenceToken
	Source            RecordingSourceInformation
	EarliestRecording xsd.DateTime
	LatestRecording   xsd.DateTime
	Content           xsd.String
	Track             []TrackInformation
	RecordingStatus   xsd.String
}
type FindRecordingResultList struct {
	SearchState          xsd.String
	RecordingInformation []RecordingInformation
}
type GetRecordingSearchResultsResponse struct {
	ResultList FindRecordingResultList
}
