{-# LANGUAGE DeriveDataTypeable    #-}
{-# LANGUAGE DeriveGeneric         #-}
{-# LANGUAGE FlexibleContexts      #-}
{-# LANGUAGE FlexibleInstances     #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedLists       #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE PackageImports        #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TemplateHaskell       #-}
{-# LANGUAGE TypeFamilies          #-}
{-# Language QuasiQuotes           #-}

-- |
-- Module      :  Data.SAM.Version1_6.Header.HD
-- Copyright   :  (c) Matthew Mosior 2023
-- License     :  BSD-style
-- Maintainer  :  mattm.github@gmail.com
-- Portability :  portable
--
-- = WARNING
--
-- This module is considered __internal__.
--
-- The Package Versioning Policy __does not apply__.
--
-- The contents of this module may change __in any way whatsoever__
-- and __without any warning__ between minor versions of this package.
--
-- Authors importing this library are expected to track development
-- closely.
--
-- All credit goes to the author(s)/maintainer(s) of the
-- [containers](https://hackage.haskell.org/package/containers) library
-- for the above warning text.
--
-- = Description
--
-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.

module Data.SAM.Version1_6.Header.HD ( -- * SAM version 1.6 File-level metadata data type
                                       SAM_V1_6_File_Level_Metadata(..),
                                       -- * SAM version 1.6 File-Level Metadata data types
                                       SAM_V1_6_File_Level_Metadata_Format_Version(..),
                                       SAM_V1_6_File_Level_Metadata_Sorting_Order(..),
                                       SAM_V1_6_File_Level_Metadata_Alignment_Grouping(..),
                                       SAM_V1_6_File_Level_Metadata_SubSorting_Order(..)
                                     ) where

import Data.ByteString
import Data.Data
import Data.Sequence
import Data.Word
import Generics.Deriving.Base


-- | Custom SAM (version 1.6) @"SAM_V1_6_File_Level_Metadata"@ data type.
-- See section 1.3 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.
data SAM_V1_6_File_Level_Metadata = SAM_V1_6_File_Level_Metadata { SAM_V1_6_File_Level_Metadata
-> SAM_V1_6_File_Level_Metadata_Format_Version
sam_v1_6_file_level_metadata_format_version     :: SAM_V1_6_File_Level_Metadata_Format_Version
                                                                 , SAM_V1_6_File_Level_Metadata
-> Maybe SAM_V1_6_File_Level_Metadata_Sorting_Order
sam_v1_6_file_level_metadata_sorting_order      :: Maybe SAM_V1_6_File_Level_Metadata_Sorting_Order
                                                                 , SAM_V1_6_File_Level_Metadata
-> Maybe SAM_V1_6_File_Level_Metadata_Alignment_Grouping
sam_v1_6_file_level_metadata_alignment_grouping :: Maybe SAM_V1_6_File_Level_Metadata_Alignment_Grouping
                                                                 , SAM_V1_6_File_Level_Metadata
-> Maybe SAM_V1_6_File_Level_Metadata_SubSorting_Order
sam_v1_6_file_level_metadata_subsorting_order   :: Maybe SAM_V1_6_File_Level_Metadata_SubSorting_Order
                                                                 }
   deriving ((forall x.
 SAM_V1_6_File_Level_Metadata -> Rep SAM_V1_6_File_Level_Metadata x)
-> (forall x.
    Rep SAM_V1_6_File_Level_Metadata x -> SAM_V1_6_File_Level_Metadata)
-> Generic SAM_V1_6_File_Level_Metadata
forall x.
Rep SAM_V1_6_File_Level_Metadata x -> SAM_V1_6_File_Level_Metadata
forall x.
SAM_V1_6_File_Level_Metadata -> Rep SAM_V1_6_File_Level_Metadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
SAM_V1_6_File_Level_Metadata -> Rep SAM_V1_6_File_Level_Metadata x
from :: forall x.
SAM_V1_6_File_Level_Metadata -> Rep SAM_V1_6_File_Level_Metadata x
$cto :: forall x.
Rep SAM_V1_6_File_Level_Metadata x -> SAM_V1_6_File_Level_Metadata
to :: forall x.
Rep SAM_V1_6_File_Level_Metadata x -> SAM_V1_6_File_Level_Metadata
Generic,Typeable)

-- | VN tag for @"SAM_V1_6_File_Level_Metadata"@.
data SAM_V1_6_File_Level_Metadata_Format_Version = SAM_V1_6_File_Level_Metadata_Format_Version { SAM_V1_6_File_Level_Metadata_Format_Version -> Seq Word8
sam_v1_6_file_level_metadata_format_version_tag   :: Seq Word8
                                                                                               , SAM_V1_6_File_Level_Metadata_Format_Version -> ByteString
sam_v1_6_file_level_metadata_format_version_value :: ByteString
                                                                                               }
  deriving ((forall x.
 SAM_V1_6_File_Level_Metadata_Format_Version
 -> Rep SAM_V1_6_File_Level_Metadata_Format_Version x)
-> (forall x.
    Rep SAM_V1_6_File_Level_Metadata_Format_Version x
    -> SAM_V1_6_File_Level_Metadata_Format_Version)
-> Generic SAM_V1_6_File_Level_Metadata_Format_Version
forall x.
Rep SAM_V1_6_File_Level_Metadata_Format_Version x
-> SAM_V1_6_File_Level_Metadata_Format_Version
forall x.
SAM_V1_6_File_Level_Metadata_Format_Version
-> Rep SAM_V1_6_File_Level_Metadata_Format_Version x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
SAM_V1_6_File_Level_Metadata_Format_Version
-> Rep SAM_V1_6_File_Level_Metadata_Format_Version x
from :: forall x.
SAM_V1_6_File_Level_Metadata_Format_Version
-> Rep SAM_V1_6_File_Level_Metadata_Format_Version x
$cto :: forall x.
Rep SAM_V1_6_File_Level_Metadata_Format_Version x
-> SAM_V1_6_File_Level_Metadata_Format_Version
to :: forall x.
Rep SAM_V1_6_File_Level_Metadata_Format_Version x
-> SAM_V1_6_File_Level_Metadata_Format_Version
Generic,Typeable)

-- | Eq instance for @"SAM_V1_6_File_Level_Metadata_Format_Version"@.
instance Eq SAM_V1_6_File_Level_Metadata_Format_Version where
  SAM_V1_6_File_Level_Metadata_Format_Version Seq Word8
sam_v1_6_file_level_metadata_format_version_tag1 ByteString
sam_v1_6_file_level_metadata_format_version_value1 == :: SAM_V1_6_File_Level_Metadata_Format_Version
-> SAM_V1_6_File_Level_Metadata_Format_Version -> Bool
== SAM_V1_6_File_Level_Metadata_Format_Version Seq Word8
sam_v1_6_file_level_metadata_format_version_tag2 ByteString
sam_v1_6_file_level_metadata_format_version_value2 = Seq Word8
sam_v1_6_file_level_metadata_format_version_tag1 Seq Word8 -> Seq Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Seq Word8
sam_v1_6_file_level_metadata_format_version_tag2 Bool -> Bool -> Bool
&& ByteString
sam_v1_6_file_level_metadata_format_version_value1 ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
sam_v1_6_file_level_metadata_format_version_value2

-- | Show instance for @"SAM_V1_6_File_Level_Metadata_Format_Version"@.
instance Show SAM_V1_6_File_Level_Metadata_Format_Version where
  show :: SAM_V1_6_File_Level_Metadata_Format_Version -> String
show (SAM_V1_6_File_Level_Metadata_Format_Version Seq Word8
tag ByteString
value) = String
"SAM_V1_6_File_Level_Metadata_Format_Version { " String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                 String
"tag = "                                         String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                 (Seq Word8 -> String
forall a. Show a => a -> String
show Seq Word8
tag)                                       String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                 String
" , value = "                                    String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                 (ByteString -> String
forall a. Show a => a -> String
show ByteString
value)                                     String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                 String
" }"

-- | SO tag for @"SAM_V1_6_File_Level_Metadata"@.
data SAM_V1_6_File_Level_Metadata_Sorting_Order = SAM_V1_6_File_Level_Metadata_Sorting_Order { SAM_V1_6_File_Level_Metadata_Sorting_Order -> Seq Word8
sam_v1_6_file_level_metadata_sorting_order_tag   :: Seq Word8
                                                                                             , SAM_V1_6_File_Level_Metadata_Sorting_Order -> ByteString
sam_v1_6_file_level_metadata_sorting_order_value :: ByteString
                                                                                             }
  deriving ((forall x.
 SAM_V1_6_File_Level_Metadata_Sorting_Order
 -> Rep SAM_V1_6_File_Level_Metadata_Sorting_Order x)
-> (forall x.
    Rep SAM_V1_6_File_Level_Metadata_Sorting_Order x
    -> SAM_V1_6_File_Level_Metadata_Sorting_Order)
-> Generic SAM_V1_6_File_Level_Metadata_Sorting_Order
forall x.
Rep SAM_V1_6_File_Level_Metadata_Sorting_Order x
-> SAM_V1_6_File_Level_Metadata_Sorting_Order
forall x.
SAM_V1_6_File_Level_Metadata_Sorting_Order
-> Rep SAM_V1_6_File_Level_Metadata_Sorting_Order x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
SAM_V1_6_File_Level_Metadata_Sorting_Order
-> Rep SAM_V1_6_File_Level_Metadata_Sorting_Order x
from :: forall x.
SAM_V1_6_File_Level_Metadata_Sorting_Order
-> Rep SAM_V1_6_File_Level_Metadata_Sorting_Order x
$cto :: forall x.
Rep SAM_V1_6_File_Level_Metadata_Sorting_Order x
-> SAM_V1_6_File_Level_Metadata_Sorting_Order
to :: forall x.
Rep SAM_V1_6_File_Level_Metadata_Sorting_Order x
-> SAM_V1_6_File_Level_Metadata_Sorting_Order
Generic,Typeable)

-- | Eq instance for @"SAM_V1_6_File_Level_Metadata_Sorting_Order"@.
instance Eq SAM_V1_6_File_Level_Metadata_Sorting_Order where
  SAM_V1_6_File_Level_Metadata_Sorting_Order Seq Word8
sam_v1_6_file_level_metadata_sorting_order_tag1 ByteString
sam_v1_6_file_level_metadata_sorting_order_value1 == :: SAM_V1_6_File_Level_Metadata_Sorting_Order
-> SAM_V1_6_File_Level_Metadata_Sorting_Order -> Bool
== SAM_V1_6_File_Level_Metadata_Sorting_Order Seq Word8
sam_v1_6_file_level_metadata_sorting_order_tag2 ByteString
sam_v1_6_file_level_metadata_sorting_order_value2 = Seq Word8
sam_v1_6_file_level_metadata_sorting_order_tag1 Seq Word8 -> Seq Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Seq Word8
sam_v1_6_file_level_metadata_sorting_order_tag2 Bool -> Bool -> Bool
&& ByteString
sam_v1_6_file_level_metadata_sorting_order_value1 ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
sam_v1_6_file_level_metadata_sorting_order_value2

-- | Show instance for @"SAM_V1_6_File_Level_Metadata_Sorting_Order"@.
instance Show SAM_V1_6_File_Level_Metadata_Sorting_Order where
  show :: SAM_V1_6_File_Level_Metadata_Sorting_Order -> String
show (SAM_V1_6_File_Level_Metadata_Sorting_Order Seq Word8
tag ByteString
value) = String
"SAM_V1_6_File_Level_Metadata_Sorting_Order { " String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                String
"tag = "                                        String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                (Seq Word8 -> String
forall a. Show a => a -> String
show Seq Word8
tag)                                      String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                String
" , value = "                                   String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                (ByteString -> String
forall a. Show a => a -> String
show ByteString
value)                                    String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                String
" }"

-- | GO tag for @"SAM_V1_6_File_Level_Metadata"@.
data SAM_V1_6_File_Level_Metadata_Alignment_Grouping = SAM_V1_6_File_Level_Metadata_Alignment_Grouping { SAM_V1_6_File_Level_Metadata_Alignment_Grouping -> Seq Word8
sam_v1_6_file_level_metadata_alignment_grouping_tag   :: Seq Word8
                                                                                                       , SAM_V1_6_File_Level_Metadata_Alignment_Grouping -> ByteString
sam_v1_6_file_level_metadata_alignment_grouping_value :: ByteString
                                                                                                       }
  deriving ((forall x.
 SAM_V1_6_File_Level_Metadata_Alignment_Grouping
 -> Rep SAM_V1_6_File_Level_Metadata_Alignment_Grouping x)
-> (forall x.
    Rep SAM_V1_6_File_Level_Metadata_Alignment_Grouping x
    -> SAM_V1_6_File_Level_Metadata_Alignment_Grouping)
-> Generic SAM_V1_6_File_Level_Metadata_Alignment_Grouping
forall x.
Rep SAM_V1_6_File_Level_Metadata_Alignment_Grouping x
-> SAM_V1_6_File_Level_Metadata_Alignment_Grouping
forall x.
SAM_V1_6_File_Level_Metadata_Alignment_Grouping
-> Rep SAM_V1_6_File_Level_Metadata_Alignment_Grouping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
SAM_V1_6_File_Level_Metadata_Alignment_Grouping
-> Rep SAM_V1_6_File_Level_Metadata_Alignment_Grouping x
from :: forall x.
SAM_V1_6_File_Level_Metadata_Alignment_Grouping
-> Rep SAM_V1_6_File_Level_Metadata_Alignment_Grouping x
$cto :: forall x.
Rep SAM_V1_6_File_Level_Metadata_Alignment_Grouping x
-> SAM_V1_6_File_Level_Metadata_Alignment_Grouping
to :: forall x.
Rep SAM_V1_6_File_Level_Metadata_Alignment_Grouping x
-> SAM_V1_6_File_Level_Metadata_Alignment_Grouping
Generic,Typeable)

-- | Eq instance for @"SAM_V1_6_File_Level_Metadata_Alignment_Grouping"@.
instance Eq SAM_V1_6_File_Level_Metadata_Alignment_Grouping where
  SAM_V1_6_File_Level_Metadata_Alignment_Grouping Seq Word8
sam_v1_6_file_level_metadata_alignment_grouping_tag1 ByteString
sam_v1_6_file_level_metadata_alignment_grouping_value1 == :: SAM_V1_6_File_Level_Metadata_Alignment_Grouping
-> SAM_V1_6_File_Level_Metadata_Alignment_Grouping -> Bool
== SAM_V1_6_File_Level_Metadata_Alignment_Grouping Seq Word8
sam_v1_6_file_level_metadata_alignment_grouping_tag2 ByteString
sam_v1_6_file_level_metadata_alignment_grouping_value2 = Seq Word8
sam_v1_6_file_level_metadata_alignment_grouping_tag1 Seq Word8 -> Seq Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Seq Word8
sam_v1_6_file_level_metadata_alignment_grouping_tag2 Bool -> Bool -> Bool
&& ByteString
sam_v1_6_file_level_metadata_alignment_grouping_value1 ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
sam_v1_6_file_level_metadata_alignment_grouping_value2

-- | Show instance for @"SAM_V1_6_File_Level_Metadata_Alignment_Grouping"@.
instance Show SAM_V1_6_File_Level_Metadata_Alignment_Grouping where
  show :: SAM_V1_6_File_Level_Metadata_Alignment_Grouping -> String
show (SAM_V1_6_File_Level_Metadata_Alignment_Grouping Seq Word8
tag ByteString
value) = String
"SAM_V1_6_File_Level_Metadata_Alignment_Grouping { " String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                     String
"tag = "                                             String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                     (Seq Word8 -> String
forall a. Show a => a -> String
show Seq Word8
tag)                                           String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                     String
" , value = "                                        String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                     (ByteString -> String
forall a. Show a => a -> String
show ByteString
value)                                         String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                     String
" }"

-- | SS tag for @"SAM_V1_6_File_Level_Metadata"@.
data SAM_V1_6_File_Level_Metadata_SubSorting_Order = SAM_V1_6_File_Level_Metadata_SubSorting_Order { SAM_V1_6_File_Level_Metadata_SubSorting_Order -> Seq Word8
sam_v1_6_file_level_metadata_subsorting_order_tag   :: Seq Word8
                                                                                                   , SAM_V1_6_File_Level_Metadata_SubSorting_Order -> ByteString
sam_v1_6_file_level_metadata_subsorting_order_value :: ByteString
                                                                                                   }
  deriving ((forall x.
 SAM_V1_6_File_Level_Metadata_SubSorting_Order
 -> Rep SAM_V1_6_File_Level_Metadata_SubSorting_Order x)
-> (forall x.
    Rep SAM_V1_6_File_Level_Metadata_SubSorting_Order x
    -> SAM_V1_6_File_Level_Metadata_SubSorting_Order)
-> Generic SAM_V1_6_File_Level_Metadata_SubSorting_Order
forall x.
Rep SAM_V1_6_File_Level_Metadata_SubSorting_Order x
-> SAM_V1_6_File_Level_Metadata_SubSorting_Order
forall x.
SAM_V1_6_File_Level_Metadata_SubSorting_Order
-> Rep SAM_V1_6_File_Level_Metadata_SubSorting_Order x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
SAM_V1_6_File_Level_Metadata_SubSorting_Order
-> Rep SAM_V1_6_File_Level_Metadata_SubSorting_Order x
from :: forall x.
SAM_V1_6_File_Level_Metadata_SubSorting_Order
-> Rep SAM_V1_6_File_Level_Metadata_SubSorting_Order x
$cto :: forall x.
Rep SAM_V1_6_File_Level_Metadata_SubSorting_Order x
-> SAM_V1_6_File_Level_Metadata_SubSorting_Order
to :: forall x.
Rep SAM_V1_6_File_Level_Metadata_SubSorting_Order x
-> SAM_V1_6_File_Level_Metadata_SubSorting_Order
Generic,Typeable)

-- | Eq instance for @"SAM_V1_6_File_Level_Metadata_SubSorting_Order"@.
instance Eq SAM_V1_6_File_Level_Metadata_SubSorting_Order where
  SAM_V1_6_File_Level_Metadata_SubSorting_Order Seq Word8
sam_v1_6_file_level_metadata_subsorting_order_tag1 ByteString
sam_v1_6_file_level_metadata_subsorting_order_value1 == :: SAM_V1_6_File_Level_Metadata_SubSorting_Order
-> SAM_V1_6_File_Level_Metadata_SubSorting_Order -> Bool
== SAM_V1_6_File_Level_Metadata_SubSorting_Order Seq Word8
sam_v1_6_file_level_metadata_subsorting_order_tag2 ByteString
sam_v1_6_file_level_metadata_subsorting_order_value2 = Seq Word8
sam_v1_6_file_level_metadata_subsorting_order_tag1 Seq Word8 -> Seq Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Seq Word8
sam_v1_6_file_level_metadata_subsorting_order_tag2 Bool -> Bool -> Bool
&& ByteString
sam_v1_6_file_level_metadata_subsorting_order_value1 ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
sam_v1_6_file_level_metadata_subsorting_order_value2

-- | Show instance for @"SAM_V1_6_File_Level_Metadata_SubSorting_Order"@.
instance Show SAM_V1_6_File_Level_Metadata_SubSorting_Order where
  show :: SAM_V1_6_File_Level_Metadata_SubSorting_Order -> String
show (SAM_V1_6_File_Level_Metadata_SubSorting_Order Seq Word8
tag ByteString
value) = String
"SAM_V1_6_File_Level_Metadata_SubSorting_Order { " String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                   String
"tag = "                                           String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                   (Seq Word8 -> String
forall a. Show a => a -> String
show Seq Word8
tag)                                         String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                   String
" , value = "                                      String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                   (ByteString -> String
forall a. Show a => a -> String
show ByteString
value)                                       String -> ShowS
forall a. [a] -> [a] -> [a]
++
                                                                   String
" }"