//go:generate ${GOBIN}/mockgen -destination service_mock.go -package=api ${GO_MODULE}/pkg/service/kernelimage/api Service
package api

import (
	"context"

	ent "github.com/tidbcloud/devops/entity/kernelimage"
)

type ListReleasesParam struct {
	Repository string
	Version    string
	Statuses   []ent.ReleaseStatus
	Masked     *bool
	Page       int
	PerPage    int
}

type SelectionParam struct {
	ClusterType string
	Component   string
}

type BuildCallbackImage struct {
	SourceRepository string
	SourceTag        string
	SourceDigest     string
}

type BuildCallbackParam struct {
	SourceApplicant string
	SourceReleaseID string
	SourceChangeID  string
	Repo            string
	Branch          string
	CommitSHA       string
	GitTag          string
	Images          []BuildCallbackImage
}

type BuildCallbackResult struct {
	Releases   []*ent.Release
	InstanceID *uint64
}

type Service interface {
	AcceptBuildCallback(ctx context.Context, param BuildCallbackParam) (*BuildCallbackResult, error)
	CreateRelease(ctx context.Context, release *ent.Release) (*ent.Release, error)
	GetRelease(ctx context.Context, artifactUID string) (*ent.Release, error)
	ListReleases(ctx context.Context, param ListReleasesParam) ([]*ent.Release, int64, error)
	GetSelection(ctx context.Context, param SelectionParam) (*ent.SelectionResult, error)
	RefreshAvailability(ctx context.Context, artifactUID string) (*ent.Release, error)
}
