-- SPDX-FileCopyrightText: 2026 Alexandra de Wit
--
-- SPDX-License-Identifier: MIT

{- | The record "Ecluse.Core.Registry.Cargo.Archive" builds after a successful inspection, with its
fields. Importing this module opts out of the public surface's stability promises. It exists so a
spec can read the inventory.
-}
module Ecluse.Core.Registry.Cargo.Archive.Internal (
    CargoArchiveMetadata (..),
) where

import Text.Show (showString, shows, showsPrec)

import Ecluse.Core.Registry.Cargo.Manifest (CargoManifest)

-- | The inspected source bytes, checked against the admitted SHA-256 when one exists.
data CargoArchiveMetadata = CargoArchiveMetadata
    { CargoArchiveMetadata -> CargoManifest
caManifest :: CargoManifest
    , CargoArchiveMetadata -> Set Text
caInventory :: Set Text
    -- ^ Regular-file paths relative to the admitted single archive root.
    , CargoArchiveMetadata -> ByteString
caSource :: ByteString
    , CargoArchiveMetadata -> Text
caRoot :: Text
    , CargoArchiveMetadata -> Int
caRetainedBytes :: Int
    , CargoArchiveMetadata -> Int
caManifestWorkspace :: Int
    }

instance Show CargoArchiveMetadata where
    showsPrec :: Int -> CargoArchiveMetadata -> ShowS
showsPrec Int
_ CargoArchiveMetadata
metadata = String -> ShowS
showString String
"CargoArchiveMetadata " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ShowS
forall a. Show a => a -> ShowS
shows (CargoArchiveMetadata -> Text
caRoot CargoArchiveMetadata
metadata)