{- ORMOLU_DISABLE -}
{- HLINT ignore -}
-- THIS IS A GENERATED FILE, DO NOT EDIT

{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.RenameFile where

import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson as Aeson
import qualified Data.Row.Aeson as Aeson
import qualified Data.Row.Hashable as Hashable
import qualified Language.LSP.Protocol.Internal.Types.ChangeAnnotationIdentifier
import qualified Language.LSP.Protocol.Internal.Types.RenameFileOptions
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Singletons
import qualified Language.LSP.Protocol.Types.Uri

{-|
Rename file operation
-}
data RenameFile = RenameFile 
  { {-|
  An optional annotation identifier describing the operation.

  @since 3.16.0
  -}
  RenameFile -> Maybe ChangeAnnotationIdentifier
_annotationId :: (Maybe Language.LSP.Protocol.Internal.Types.ChangeAnnotationIdentifier.ChangeAnnotationIdentifier)
  , {-|
  A rename
  -}
  RenameFile -> AString "rename"
_kind :: (Language.LSP.Protocol.Types.Singletons.AString "rename")
  , {-|
  The old (existing) location.
  -}
  RenameFile -> Uri
_oldUri :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  The new location.
  -}
  RenameFile -> Uri
_newUri :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  Rename options.
  -}
  RenameFile -> Maybe RenameFileOptions
_options :: (Maybe Language.LSP.Protocol.Internal.Types.RenameFileOptions.RenameFileOptions)
  }
  deriving stock (Int -> RenameFile -> ShowS
[RenameFile] -> ShowS
RenameFile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenameFile] -> ShowS
$cshowList :: [RenameFile] -> ShowS
show :: RenameFile -> String
$cshow :: RenameFile -> String
showsPrec :: Int -> RenameFile -> ShowS
$cshowsPrec :: Int -> RenameFile -> ShowS
Show, RenameFile -> RenameFile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenameFile -> RenameFile -> Bool
$c/= :: RenameFile -> RenameFile -> Bool
== :: RenameFile -> RenameFile -> Bool
$c== :: RenameFile -> RenameFile -> Bool
Eq, Eq RenameFile
RenameFile -> RenameFile -> Bool
RenameFile -> RenameFile -> Ordering
RenameFile -> RenameFile -> RenameFile
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: RenameFile -> RenameFile -> RenameFile
$cmin :: RenameFile -> RenameFile -> RenameFile
max :: RenameFile -> RenameFile -> RenameFile
$cmax :: RenameFile -> RenameFile -> RenameFile
>= :: RenameFile -> RenameFile -> Bool
$c>= :: RenameFile -> RenameFile -> Bool
> :: RenameFile -> RenameFile -> Bool
$c> :: RenameFile -> RenameFile -> Bool
<= :: RenameFile -> RenameFile -> Bool
$c<= :: RenameFile -> RenameFile -> Bool
< :: RenameFile -> RenameFile -> Bool
$c< :: RenameFile -> RenameFile -> Bool
compare :: RenameFile -> RenameFile -> Ordering
$ccompare :: RenameFile -> RenameFile -> Ordering
Ord, forall x. Rep RenameFile x -> RenameFile
forall x. RenameFile -> Rep RenameFile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenameFile x -> RenameFile
$cfrom :: forall x. RenameFile -> Rep RenameFile x
Generic)
  deriving anyclass (RenameFile -> ()
forall a. (a -> ()) -> NFData a
rnf :: RenameFile -> ()
$crnf :: RenameFile -> ()
NFData, Eq RenameFile
Int -> RenameFile -> Int
RenameFile -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: RenameFile -> Int
$chash :: RenameFile -> Int
hashWithSalt :: Int -> RenameFile -> Int
$chashWithSalt :: Int -> RenameFile -> Int
Hashable)
  deriving forall ann. [RenameFile] -> Doc ann
forall ann. RenameFile -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [RenameFile] -> Doc ann
$cprettyList :: forall ann. [RenameFile] -> Doc ann
pretty :: forall ann. RenameFile -> Doc ann
$cpretty :: forall ann. RenameFile -> Doc ann
Pretty via (ViaJSON RenameFile)

instance Aeson.ToJSON RenameFile where
  toJSON :: RenameFile -> Value
toJSON (RenameFile Maybe ChangeAnnotationIdentifier
arg0 AString "rename"
arg1 Uri
arg2 Uri
arg3 Maybe RenameFileOptions
arg4) = [Pair] -> Value
Aeson.object forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [String
"annotationId" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ChangeAnnotationIdentifier
arg0
    ,[Key
"kind" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= AString "rename"
arg1]
    ,[Key
"oldUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg2]
    ,[Key
"newUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg3]
    ,String
"options" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe RenameFileOptions
arg4]

instance Aeson.FromJSON RenameFile where
  parseJSON :: Value -> Parser RenameFile
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"RenameFile" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ChangeAnnotationIdentifier
-> AString "rename"
-> Uri
-> Uri
-> Maybe RenameFileOptions
-> RenameFile
RenameFile forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"annotationId" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"kind" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"oldUri" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"newUri" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"options"