{-# LANGUAGE PatternSynonyms, ScopedTypeVariables, ViewPatterns #-}


{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.OSTree.Constants
    (
    pattern YEAR_VERSION                    ,
    pattern VERSION_S                       ,
    pattern VERSION                         ,
    pattern TREE_GVARIANT_STRING            ,
    pattern TIMESTAMP                       ,
    pattern SUMMARY_SIG_GVARIANT_STRING     ,
    pattern SUMMARY_GVARIANT_STRING         ,
    pattern SHA256_STRING_LEN               ,
    pattern SHA256_DIGEST_LEN               ,
    pattern REPO_METADATA_REF               ,
    pattern RELEASE_VERSION                 ,
    pattern ORIGIN_TRANSIENT_GROUP          ,
    pattern META_KEY_DEPLOY_COLLECTION_ID   ,
    pattern MAX_METADATA_WARN_SIZE          ,
    pattern MAX_METADATA_SIZE               ,
    pattern FILEMETA_GVARIANT_STRING        ,
    pattern DIRMETA_GVARIANT_STRING         ,
    pattern COMMIT_META_KEY_VERSION         ,
    pattern COMMIT_META_KEY_SOURCE_TITLE    ,
    pattern COMMIT_META_KEY_REF_BINDING     ,
    pattern COMMIT_META_KEY_ENDOFLIFE_REBASE,
    pattern COMMIT_META_KEY_ENDOFLIFE       ,
    pattern COMMIT_META_KEY_COLLECTION_BINDING,
    pattern COMMIT_GVARIANT_STRING          ,

    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL


{- |
ostree year version component (e.g. 2017 if 'GI.OSTree.Constants.VERSION' is 2017.2)

/Since: 2017.4/
-}
pattern YEAR_VERSION = 2019 :: Int32

{- |
ostree version, encoded as a string, useful for printing and
concatenation.

/Since: 2017.4/
-}
pattern VERSION_S = "2019.2" :: T.Text

{- |
ostree version.

/Since: 2017.4/
-}
pattern VERSION = 2019.200000 :: Double

{- |
/No description available in the introspection data./
-}
pattern TREE_GVARIANT_STRING = "(a(say)a(sayay))" :: T.Text

{- |
The mtime used for stored files.  This was originally 0, changed to 1 for
a few releases, then was reverted due to regressions it introduced from
users who had been using zero before.
-}
pattern TIMESTAMP = 0 :: Int32

{- |
/No description available in the introspection data./
-}
pattern SUMMARY_SIG_GVARIANT_STRING = "a{sv}" :: T.Text

{- |
/No description available in the introspection data./
-}
pattern SUMMARY_GVARIANT_STRING = "(a(s(taya{sv}))a{sv})" :: T.Text

{- |
Length of a sha256 digest when expressed as a hexadecimal string
-}
pattern SHA256_STRING_LEN = 64 :: Int32

{- |
Length of a sha256 digest when expressed as raw bytes
-}
pattern SHA256_DIGEST_LEN = 32 :: Int32

{- |
The name of a ref which is used to store metadata for the entire repository,
such as its expected update time (@ostree.summary.expires@), name, or new
GPG keys. Metadata is stored on contentless commits in the ref, and hence is
signed with the commits.

This supersedes the additional metadata dictionary in the @summary@ file
(see 'GI.OSTree.Objects.Repo.repoRegenerateSummary'), as the use of a ref means that the
metadata for multiple upstream repositories can be included in a single mirror
repository, disambiguating the refs using collection IDs. In order to support
peer to peer redistribution of repository metadata, repositories must set a
collection ID ('GI.OSTree.Objects.Repo.repoSetCollectionId').

Users of OSTree may place arbitrary metadata in commits on this ref, but the
keys must be namespaced by product or developer. For example,
@exampleos.end-of-life@. The @ostree.@ prefix is reserved.

/Since: 2018.6/
-}
pattern REPO_METADATA_REF = "ostree-metadata" :: T.Text

{- |
ostree release version component (e.g. 2 if 'GI.OSTree.Constants.VERSION' is 2017.2)

/Since: 2017.4/
-}
pattern RELEASE_VERSION = 2 :: Int32

{- |
The name of a @GKeyFile@ group for data that should not
be carried across upgrades.  For more information,
see 'GI.OSTree.Objects.Deployment.deploymentOriginRemoveTransientState'.

/Since: 2018.3/
-}
pattern ORIGIN_TRANSIENT_GROUP = "libostree-transient" :: T.Text

{- |
GVariant type @s@. This key can be used in the repo metadata which is stored
in OSTREE_REPO_METADATA_REF as well as in the summary. The semantics of this
are that the remote repository wants clients to update their remote config
to add this collection ID (clients can\'t do P2P operations involving a
remote without a collection ID configured on it, even if one is configured
on the server side). Clients must never change or remove a collection ID
already set in their remote config.

Currently, OSTree does not implement changing a remote config based on this
key, but it may do so in a later release, and until then clients such as
Flatpak may implement it.

This is a replacement for the similar metadata key implemented by flatpak,
@xa.collection-id@, which is now deprecated as clients which supported it had
bugs with their P2P implementations.

/Since: 2018.9/
-}
pattern META_KEY_DEPLOY_COLLECTION_ID = "ostree.deploy-collection-id" :: T.Text

{- |
This variable is no longer meaningful, it is kept only for compatibility.
-}
pattern MAX_METADATA_WARN_SIZE = 7340032 :: Int32

{- |
Default limit for maximum permitted size in bytes of metadata objects fetched
over HTTP (including repo\/config files, refs, and commit\/dirtree\/dirmeta
objects). This is an arbitrary number intended to mitigate disk space
exhaustion attacks.
-}
pattern MAX_METADATA_SIZE = 10485760 :: Int32

{- |
/No description available in the introspection data./
-}
pattern FILEMETA_GVARIANT_STRING = "(uuua(ayay))" :: T.Text

{- |
/No description available in the introspection data./
-}
pattern DIRMETA_GVARIANT_STRING = "(uuua(ayay))" :: T.Text

{- |
GVariant type @s@. This metadata key is used for version numbers. A freeform
string; the intention is that systems using ostree do not interpret this
semantically as traditional package managers do.

This is the only ostree-defined metadata key that does not start with @ostree.@.

/Since: 2014.9/
-}
pattern COMMIT_META_KEY_VERSION = "version" :: T.Text

{- |
GVariant type @s@. This should hold a relatively short single line value
containing a human-readable \"source\" for a commit, intended to be displayed
near the origin ref.  This is particularly useful for systems that inject
content into an OSTree commit from elsewhere - for example, generating from
an OCI or qcow2 image. Or if generating from packages, the enabled repository
names and their versions.

Try to keep this key short (e.g. \< 80 characters) and human-readable; if you
desire machine readable data, consider injecting separate metadata keys.

/Since: 2017.13/
-}
pattern COMMIT_META_KEY_SOURCE_TITLE = "ostree.source-title" :: T.Text

{- |
GVariant type @as@; each element is a branch name. If this is added to a
commit, @ostree_repo_pull()@ will enforce that the commit was retrieved from
one of the branch names in this array.  This prevents \"sidegrade\" attacks.
The rationale for having this support multiple branch names is that it helps
support a \"promotion\" model of taking a commit and moving it between development
and production branches.

/Since: 2017.9/
-}
pattern COMMIT_META_KEY_REF_BINDING = "ostree.ref-binding" :: T.Text

{- |
GVariant type @s@.  Should contain a refspec defining a new target branch;
@ostree admin upgrade@ and @OstreeSysrootUpgrader@ will automatically initiate
a rebase upon encountering this metadata key.

/Since: 2017.7/
-}
pattern COMMIT_META_KEY_ENDOFLIFE_REBASE = "ostree.endoflife-rebase" :: T.Text

{- |
GVariant type @s@. This metadata key is used to display vendor\'s message
when an update stream for a particular branch ends. It usually provides
update instructions for the users.

/Since: 2017.7/
-}
pattern COMMIT_META_KEY_ENDOFLIFE = "ostree.endoflife" :: T.Text

{- |
GVariant type @s@.  If this is added to a commit, @ostree_repo_pull()@
will enforce that the commit was retrieved from a repository which has
the same collection ID.  See @ostree_repo_set_collection_id()@.
This is most useful in concert with @OSTREE_COMMIT_META_KEY_REF_BINDING@,
as it more strongly binds the commit to the repository and branch.

/Since: 2018.6/
-}
pattern COMMIT_META_KEY_COLLECTION_BINDING = "ostree.collection-binding" :: T.Text

{- |
/No description available in the introspection data./
-}
pattern COMMIT_GVARIANT_STRING = "(a{sv}aya(say)sstayay)" :: T.Text