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"
	FailedToSumbitTaskToPool                                              = "failed to submit task to pool"
	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"
)

// Log messages with the "datapath" tag.
const (
	CouldntParseCreationDate             = "couldn't parse creation date"
	CouldNotDetectContentTypeFromPayload = "could not 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"
	CouldNotGetBucket                    = "could not get bucket"
	CouldNotResolveContainerID           = "could not resolve container id"
)

// Log messages with the "external_storage" tag.
const (
	CouldNotReceiveObject                       = "could not receive object"
	CouldNotSearchForObjects                    = "could not search for objects"
	ObjectNotFound                              = "object not found"
	ReadObjectListFailed                        = "read object list failed"
	CouldNotStoreFileInFrostfs                  = "could not store file in frostfs"
	FailedToHeadObject                          = "failed to head object"
	ObjectNotFoundByFilePathTrySearchByFileName = "object not found by filePath attribute, try search by fileName"
	FailedToGetObject                           = "failed to get object"
	ObjectUploaded                              = "object uploaded"
	CouldNotGetContainerInfo                    = "could not get container info"
)

// Log messages with the "external_storage_tree" tag.
const (
	ObjectWasDeleted                 = "object was deleted"
	FailedToGetLatestVersionOfObject = "failed to get latest version of object"
	FailedToCheckIfSettingsNodeExist = "Failed to check if settings node exists"
)