package service

import (
	"github.com/codex-k8s/kodex/libs/go/accesscatalog"
	accessevents "github.com/codex-k8s/kodex/libs/go/platformevents/access"
)

const (
	reasonAllowlistEmail       = "allowlist_email"
	reasonAllowlistDomain      = "allowlist_domain"
	reasonAllowlistDisabled    = "allowlist_disabled"
	reasonAllowlistMiss        = "allowlist_miss"
	reasonUserStatusChanged    = "user_status_changed"
	reasonAllowlistEntryClosed = "allowlist_entry_disabled"
	reasonIdentityFound        = "identity_found"
	reasonIdentityLinked       = "identity_linked"
	reasonExplicitAllow        = "explicit_allow"
	reasonExplicitDeny         = "explicit_deny"
	reasonNoMatchingRule       = "no_matching_rule"
	reasonActionNotFound       = "action_not_found"
	reasonActionDisabled       = "action_disabled"
	reasonResourceTypeMismatch = "resource_type_mismatch"
	reasonSubjectPending       = "subject_pending"
	reasonSubjectBlocked       = "subject_blocked"
	reasonExternalProviderOff  = "external_provider_disabled"
	reasonExternalAccountState = "external_account_status_changed"
	reasonExternalBindingOff   = "external_account_binding_disabled"
)

const (
	accessEventOrganizationCreated               = accessevents.EventOrganizationCreated
	accessEventGroupCreated                      = accessevents.EventGroupCreated
	accessEventMembershipCreated                 = accessevents.EventMembershipCreated
	accessEventMembershipUpdated                 = accessevents.EventMembershipUpdated
	accessEventMembershipDisabled                = accessevents.EventMembershipDisabled
	accessEventAllowlistEntryCreated             = accessevents.EventAllowlistEntryCreated
	accessEventAllowlistEntryUpdated             = accessevents.EventAllowlistEntryUpdated
	accessEventAllowlistEntryDisabled            = accessevents.EventAllowlistEntryDisabled
	accessEventUserCreated                       = accessevents.EventUserCreated
	accessEventUserStatusChanged                 = accessevents.EventUserStatusChanged
	accessEventUserIdentityLinked                = accessevents.EventUserIdentityLinked
	accessEventExternalProviderCreated           = accessevents.EventExternalProviderCreated
	accessEventExternalProviderUpdated           = accessevents.EventExternalProviderUpdated
	accessEventExternalProviderDisabled          = accessevents.EventExternalProviderDisabled
	accessEventExternalAccountCreated            = accessevents.EventExternalAccountCreated
	accessEventExternalAccountStatusChanged      = accessevents.EventExternalAccountStatusChanged
	accessEventExternalAccountBindingCreated     = accessevents.EventExternalAccountBindingCreated
	accessEventExternalAccountBindingUpdated     = accessevents.EventExternalAccountBindingUpdated
	accessEventExternalAccountBindingDisabled    = accessevents.EventExternalAccountBindingDisabled
	accessEventAccessActionCreated               = accessevents.EventAccessActionCreated
	accessEventAccessActionUpdated               = accessevents.EventAccessActionUpdated
	accessEventAccessRuleCreated                 = accessevents.EventAccessRuleCreated
	accessEventAccessRuleUpdated                 = accessevents.EventAccessRuleUpdated
	accessEventAccessDecisionRecorded            = accessevents.EventAccessDecisionRecorded
	accessAggregateOrganization                  = accessevents.AggregateOrganization
	accessAggregateGroup                         = accessevents.AggregateGroup
	accessAggregateMembership                    = accessevents.AggregateMembership
	accessAggregateAllowlistEntry                = accessevents.AggregateAllowlistEntry
	accessAggregateUser                          = accessevents.AggregateUser
	accessAggregateExternalProvider              = accessevents.AggregateExternalProvider
	accessAggregateExternalAccount               = accessevents.AggregateExternalAccount
	accessAggregateExternalAccountBinding        = accessevents.AggregateExternalAccountBinding
	accessAggregateAccessAction                  = accessevents.AggregateAccessAction
	accessAggregateAccessRule                    = accessevents.AggregateAccessRule
	accessAggregateAccessDecisionAudit           = accessevents.AggregateAccessDecisionAudit
	accessOperationCreateOrganization            = "domain.Service.CreateOrganization"
	accessOperationCreateGroup                   = "domain.Service.CreateGroup"
	accessOperationSetUserStatus                 = "domain.Service.SetUserStatus"
	accessOperationDisableAllowlistEntry         = "domain.Service.DisableAllowlistEntry"
	accessOperationUpdateExternalProvider        = "domain.Service.UpdateExternalProvider"
	accessOperationRegisterExternalAccount       = "domain.Service.RegisterExternalAccount"
	accessOperationUpdateExternalAccountStatus   = "domain.Service.UpdateExternalAccountStatus"
	accessOperationDisableExternalAccountBinding = "domain.Service.DisableExternalAccountBinding"
	accessRuleScopeGlobal                        = "global"
	accessRuleScopeOrganization                  = "organization"
	accessRuleScopeProject                       = "project"
	accessRuleScopeRepository                    = "repository"
	accessActionExplainAccess                    = "access.audit.explain"
	accessActionSetUserStatus                    = "access.user.status.set"
	accessActionDisableAllowlistEntry            = "access.allowlist_entry.disable"
	accessActionListPendingAccess                = "access.pending_access.list"
	accessActionListMembershipGraph              = "access.membership_graph.list"
	accessActionManageExternalProvider           = "access.external_provider.manage"
	accessActionManageExternalAccount            = "access.external_account.manage"
	accessActionManageExternalAccountBinding     = "access.external_account_binding.manage"
	accessActionPackageInstallationSecretRefRead = accesscatalog.ActionPackageInstallationSecretRefRead
	accessResourceAccessDecisionAudit            = "access_decision_audit"
	accessResourceUser                           = "user"
	accessResourceAllowlistEntry                 = "allowlist_entry"
	accessResourcePendingAccess                  = "pending_access"
	accessResourceMembershipGraph                = "membership_graph"
	accessResourceExternalProvider               = "external_provider"
	accessResourceExternalAccount                = "external_account"
	accessResourceExternalAccountBinding         = "external_account_binding"
	accessResourcePackageInstallationSecretRef   = accesscatalog.ResourcePackageInstallationSecretRef
	packageInstallationScopePlatform             = "platform"
)
