{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE StrictData        #-}

{-|
Module      : Headroom.Header.Types
Description : Data types for "Headroom.Header"
Copyright   : (c) 2019-2021 Vaclav Svejcar
License     : BSD-3-Clause
Maintainer  : vaclav.svejcar@gmail.com
Stability   : experimental
Portability : POSIX

This module contains data types for "Headroom.Header" module.
-}

module Headroom.Header.Types
  ( -- * Data Types
    HeaderInfo(..)
  , HeaderTemplate(..)
  )
where

import           Headroom.Configuration.Types        ( CtHeaderConfig )
import           Headroom.FileSupport.TemplateData   ( TemplateData )
import           Headroom.FileType.Types             ( FileType )
import           Headroom.Meta                       ( TemplateType )
import           Headroom.Variables.Types            ( Variables )
import           RIO


-- | Info extracted about the source code file header.
data HeaderInfo = HeaderInfo
  { HeaderInfo -> FileType
hiFileType     :: FileType
  -- ^ type of the file
  , HeaderInfo -> CtHeaderConfig
hiHeaderConfig :: CtHeaderConfig
  -- ^ configuration for license header
  , HeaderInfo -> Maybe (Int, Int)
hiHeaderPos    :: Maybe (Int, Int)
  -- ^ position of existing license header
  , HeaderInfo -> Variables
hiVariables    :: Variables
  -- ^ additional extracted variables
  }
  deriving (HeaderInfo -> HeaderInfo -> Bool
(HeaderInfo -> HeaderInfo -> Bool)
-> (HeaderInfo -> HeaderInfo -> Bool) -> Eq HeaderInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeaderInfo -> HeaderInfo -> Bool
$c/= :: HeaderInfo -> HeaderInfo -> Bool
== :: HeaderInfo -> HeaderInfo -> Bool
$c== :: HeaderInfo -> HeaderInfo -> Bool
Eq, Int -> HeaderInfo -> ShowS
[HeaderInfo] -> ShowS
HeaderInfo -> String
(Int -> HeaderInfo -> ShowS)
-> (HeaderInfo -> String)
-> ([HeaderInfo] -> ShowS)
-> Show HeaderInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeaderInfo] -> ShowS
$cshowList :: [HeaderInfo] -> ShowS
show :: HeaderInfo -> String
$cshow :: HeaderInfo -> String
showsPrec :: Int -> HeaderInfo -> ShowS
$cshowsPrec :: Int -> HeaderInfo -> ShowS
Show)


-- | Represents info about concrete header template.
data HeaderTemplate = HeaderTemplate
  { HeaderTemplate -> CtHeaderConfig
htConfig       :: CtHeaderConfig
  -- ^ header configuration
  , HeaderTemplate -> TemplateData
htTemplateData :: TemplateData
  -- ^ extra template data extracted by the correcponding file type support
  , HeaderTemplate -> FileType
htFileType     :: FileType
  -- ^ type of the file this template is for
  , HeaderTemplate -> TemplateType
htTemplate     :: TemplateType
  -- ^ parsed template
  }
  deriving (HeaderTemplate -> HeaderTemplate -> Bool
(HeaderTemplate -> HeaderTemplate -> Bool)
-> (HeaderTemplate -> HeaderTemplate -> Bool) -> Eq HeaderTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeaderTemplate -> HeaderTemplate -> Bool
$c/= :: HeaderTemplate -> HeaderTemplate -> Bool
== :: HeaderTemplate -> HeaderTemplate -> Bool
$c== :: HeaderTemplate -> HeaderTemplate -> Bool
Eq, Int -> HeaderTemplate -> ShowS
[HeaderTemplate] -> ShowS
HeaderTemplate -> String
(Int -> HeaderTemplate -> ShowS)
-> (HeaderTemplate -> String)
-> ([HeaderTemplate] -> ShowS)
-> Show HeaderTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeaderTemplate] -> ShowS
$cshowList :: [HeaderTemplate] -> ShowS
show :: HeaderTemplate -> String
$cshow :: HeaderTemplate -> String
showsPrec :: Int -> HeaderTemplate -> ShowS
$cshowsPrec :: Int -> HeaderTemplate -> ShowS
Show)