package logs

import "go.uber.org/zap"

const (
	TagFieldName = "tag"

	TagApp                 = "app"
	TagDatapath            = "datapath"
	TagExternalStorage     = "external_storage"
	TagExternalStorageTree = "external_storage_tree"
)

func TagField(tag string) zap.Field {
	return zap.String(TagFieldName, tag)
}

// Log messages with the "app" tag.
const (
	ServiceIsRunning                                                      = "service is running"
	ServiceCouldntStartOnConfiguredPort                                   = "service couldn't start on configured port"
	ServiceHasntStartedSinceItsDisabled                                   = "service hasn't started since it's disabled"
	ShuttingDownService                                                   = "shutting down service"
	CantShutDownService                                                   = "can't shut down service"
	CantGracefullyShutDownService                                         = "can't gracefully shut down service, force stop"
	FailedToCreateResolver                                                = "failed to create resolver"
	FailedToCreateWorkerPool                                              = "failed to create worker pool"
	StartingApplication                                                   = "starting application"
	StartingServer                                                        = "starting server"
	ListenAndServe                                                        = "listen and serve"
	ShuttingDownWebServer                                                 = "shutting down web server"
	FailedToShutdownTracing                                               = "failed to shutdown tracing"
	AddedPathUploadCid                                                    = "added path /upload/{cid}"
	AddedPathGetCidOid                                                    = "added path /get/{cid}/{oid}"
	AddedPathGetByAttributeCidAttrKeyAttrVal                              = "added path /get_by_attribute/{cid}/{attr_key}/{attr_val:*}"
	AddedPathZipCidPrefix                                                 = "added path /zip/{cid}/{prefix}"
	FailedToAddServer                                                     = "failed to add server"
	AddServer                                                             = "add server"
	NoHealthyServers                                                      = "no healthy servers"
	FailedToInitializeTracing                                             = "failed to initialize tracing"
	RuntimeSoftMemoryDefinedWithGOMEMLIMIT                                = "soft runtime memory defined with GOMEMLIMIT environment variable, config value skipped"
	RuntimeSoftMemoryLimitUpdated                                         = "soft runtime memory limit value updated"
	CouldNotLoadFrostFSPrivateKey                                         = "could not load FrostFS private key"
	UsingCredentials                                                      = "using credentials"
	FailedToCreateConnectionPool                                          = "failed to create connection pool"
	FailedToDialConnectionPool                                            = "failed to dial connection pool"
	FailedToCreateTreePool                                                = "failed to create tree pool"
	FailedToDialTreePool                                                  = "failed to dial tree pool"
	ServerReconnecting                                                    = "reconnecting server..."
	ServerReconnectedSuccessfully                                         = "server reconnected successfully"
	ServerReconnectFailed                                                 = "failed to reconnect server"
	MultinetDialSuccess                                                   = "multinet dial successful"
	MultinetDialFail                                                      = "multinet dial failed"
	ContainerResolverWillBeDisabledBecauseOfResolversResolverOrderIsEmpty = "container resolver will be disabled because of resolvers 'resolver_order' is empty"
	MetricsAreDisabled                                                    = "metrics are disabled"
	NoWalletPathSpecifiedCreatingEphemeralKeyAutomaticallyForThisRun      = "no wallet path specified, creating ephemeral key automatically for this run"
	SIGHUPConfigReloadStarted                                             = "SIGHUP config reload started"
	FailedToReloadConfigBecauseItsMissed                                  = "failed to reload config because it's missed"
	FailedToReloadConfig                                                  = "failed to reload config"
	FailedToUpdateResolvers                                               = "failed to update resolvers"
	FailedToReloadServerParameters                                        = "failed to reload server parameters"
	SIGHUPConfigReloadCompleted                                           = "SIGHUP config reload completed"
	TracingConfigUpdated                                                  = "tracing config updated"
	ResolverNNSWontBeUsedSinceRPCEndpointIsntProvided                     = "resolver nns won't be used since rpc_endpoint isn't provided"
	AddedStoragePeer                                                      = "added storage peer"
	InvalidLifetimeUsingDefaultValue                                      = "invalid lifetime, using default value (in seconds)"
	InvalidCacheSizeUsingDefaultValue                                     = "invalid cache size, using default value"
	WarnDuplicateAddress                                                  = "duplicate address"
	FailedToLoadMultinetConfig                                            = "failed to load multinet config"
	MultinetConfigWontBeUpdated                                           = "multinet config won't be updated"
	LogLevelWontBeUpdated                                                 = "log level won't be updated"
	TagsLogConfigWontBeUpdated                                            = "tags log config won't be updated"
	FailedToReadIndexPageTemplate                                         = "failed to read index page template"
	SetCustomIndexPageTemplate                                            = "set custom index page template"
	CouldNotFetchCORSContainerInfo                                        = "couldn't fetch CORS container info"
)

// Log messages with the "datapath" tag.
const (
	CouldntParseCreationDate              = "couldn't parse creation date"
	FailedToDetectContentTypeFromPayload  = "failed to detect Content-Type from payload"
	FailedToAddObjectToArchive            = "failed to add object to archive"
	CloseZipWriter                        = "close zip writer"
	IgnorePartEmptyFormName               = "ignore part, empty form name"
	IgnorePartEmptyFilename               = "ignore part, empty filename"
	CouldNotParseClientTime               = "could not parse client time"
	CouldNotPrepareExpirationHeader       = "could not prepare expiration header"
	CouldNotEncodeResponse                = "could not encode response"
	AddAttributeToResultObject            = "add attribute to result object"
	Request                               = "request"
	CouldNotFetchAndStoreBearerToken      = "could not fetch and store bearer token"
	CouldntPutBucketIntoCache             = "couldn't put bucket info into cache"
	FailedToIterateOverResponse           = "failed to iterate over search response"
	InvalidCacheEntryType                 = "invalid cache entry type"
	FailedToUnescapeQuery                 = "failed to unescape query"
	CouldntCacheNetmap                    = "couldn't cache netmap"
	FailedToCloseReader                   = "failed to close reader"
	FailedToFilterHeaders                 = "failed to filter headers"
	FailedToReadFileFromTar               = "failed to read file from tar"
	FailedToGetAttributes                 = "failed to get attributes"
	CloseGzipWriter                       = "close gzip writer"
	CloseTarWriter                        = "close tar writer"
	FailedToCreateGzipReader              = "failed to create gzip reader"
	GzipReaderSelected                    = "gzip reader selected"
	CouldNotReceiveMultipartForm          = "could not receive multipart/form"
	ObjectsNotFound                       = "objects not found"
	IteratingOverSelectedObjectsFailed    = "iterating over selected objects failed"
	FailedToGetBucketInfo                 = "could not get bucket info"
	FailedToSubmitTaskToPool              = "failed to submit task to pool"
	ObjectWasDeleted                      = "object was deleted"
	FailedToGetLatestVersionOfObject      = "failed to get latest version of object"
	FailedToCheckIfSettingsNodeExist      = "failed to check if settings node exists"
	FailedToListObjects                   = "failed to list objects"
	FailedToParseTemplate                 = "failed to parse template"
	FailedToExecuteTemplate               = "failed to execute template"
	FailedToUploadObject                  = "failed to upload object"
	FailedToHeadObject                    = "failed to head object"
	FailedToGetObject                     = "failed to get object"
	FailedToGetObjectPayload              = "failed to get object payload"
	FailedToFindObjectByAttribute         = "failed to get find object by attribute"
	FailedToUnescapeOIDParam              = "failed to unescape oid param"
	InvalidOIDParam                       = "invalid oid param"
	CouldNotGetCORSConfiguration          = "could not get cors configuration"
	EmptyOriginRequestHeader              = "empty Origin request header"
	EmptyAccessControlRequestMethodHeader = "empty Access-Control-Request-Method request header"
	CORSRuleWasNotMatched                 = "cors rule was not matched"
	CouldntCacheCors                      = "couldn't cache cors"
)

// Log messages with the "external_storage" tag.
const (
	ObjectNotFound                              = "object not found"
	ReadObjectListFailed                        = "read object list failed"
	ObjectNotFoundByFilePathTrySearchByFileName = "object not found by filePath attribute, try search by fileName"
	ObjectUploaded                              = "object uploaded"
)

// Log messages with the "external_storage_tree" tag.
const (
	FoundSeveralSystemTreeNodes = "found several system tree nodes"
)