-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2025 Wire Swiss GmbH <opensource@wire.com>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module Testlib.Printing where

import Prelude

yellow :: String
yellow :: String
yellow = String
"\x1b[38;5;11m"

blue :: String
blue :: String
blue = String
"\x1b[38;5;6m"

purpleish :: String
purpleish :: String
purpleish = String
"\x1b[38;5;13m"

orange :: String
orange :: String
orange = String
"\x1b[38;5;3m"

red :: String
red :: String
red = String
"\x1b[38;5;9m"

green :: String
green :: String
green = String
"\x1b[32m"

gray :: String
gray :: String
gray = String
"\x1b[38;5;250m"

resetColor :: String
resetColor :: String
resetColor = String
"\x1b[0m"

colored :: String -> String -> String
colored :: String -> String -> String
colored String
color String
s = String
color String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
s String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
resetColor

indent :: Int -> String -> String
indent :: Int -> String -> String
indent Int
n String
s =
  [String] -> String
unlines ((String -> String) -> [String] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (String
pad <>) (String -> [String]
lines String
s))
  where
    pad :: String
pad = Int -> Char -> String
forall a. Int -> a -> [a]
replicate Int
n Char
' '

hline :: String
hline :: String
hline = Int -> Char -> String
forall a. Int -> a -> [a]
replicate Int
40 Char
'-'