{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Evidently.Types.RefResource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Evidently.Types.RefResource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A structure that contains information about one experiment or launch
-- that uses the specified segment.
--
-- /See:/ 'newRefResource' smart constructor.
data RefResource = RefResource'
  { -- | The ARN of the experiment or launch.
    RefResource -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The day and time that this experiment or launch ended.
    RefResource -> Maybe Text
endTime :: Prelude.Maybe Prelude.Text,
    -- | The day and time that this experiment or launch was most recently
    -- updated.
    RefResource -> Maybe Text
lastUpdatedOn :: Prelude.Maybe Prelude.Text,
    -- | The day and time that this experiment or launch started.
    RefResource -> Maybe Text
startTime :: Prelude.Maybe Prelude.Text,
    -- | The status of the experiment or launch.
    RefResource -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the experiment or launch.
    RefResource -> Text
name :: Prelude.Text,
    -- | Specifies whether the resource that this structure contains information
    -- about is an experiment or a launch.
    RefResource -> Text
type' :: Prelude.Text
  }
  deriving (RefResource -> RefResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefResource -> RefResource -> Bool
$c/= :: RefResource -> RefResource -> Bool
== :: RefResource -> RefResource -> Bool
$c== :: RefResource -> RefResource -> Bool
Prelude.Eq, ReadPrec [RefResource]
ReadPrec RefResource
Int -> ReadS RefResource
ReadS [RefResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RefResource]
$creadListPrec :: ReadPrec [RefResource]
readPrec :: ReadPrec RefResource
$creadPrec :: ReadPrec RefResource
readList :: ReadS [RefResource]
$creadList :: ReadS [RefResource]
readsPrec :: Int -> ReadS RefResource
$creadsPrec :: Int -> ReadS RefResource
Prelude.Read, Int -> RefResource -> ShowS
[RefResource] -> ShowS
RefResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RefResource] -> ShowS
$cshowList :: [RefResource] -> ShowS
show :: RefResource -> String
$cshow :: RefResource -> String
showsPrec :: Int -> RefResource -> ShowS
$cshowsPrec :: Int -> RefResource -> ShowS
Prelude.Show, forall x. Rep RefResource x -> RefResource
forall x. RefResource -> Rep RefResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RefResource x -> RefResource
$cfrom :: forall x. RefResource -> Rep RefResource x
Prelude.Generic)

-- |
-- Create a value of 'RefResource' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'arn', 'refResource_arn' - The ARN of the experiment or launch.
--
-- 'endTime', 'refResource_endTime' - The day and time that this experiment or launch ended.
--
-- 'lastUpdatedOn', 'refResource_lastUpdatedOn' - The day and time that this experiment or launch was most recently
-- updated.
--
-- 'startTime', 'refResource_startTime' - The day and time that this experiment or launch started.
--
-- 'status', 'refResource_status' - The status of the experiment or launch.
--
-- 'name', 'refResource_name' - The name of the experiment or launch.
--
-- 'type'', 'refResource_type' - Specifies whether the resource that this structure contains information
-- about is an experiment or a launch.
newRefResource ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  Prelude.Text ->
  RefResource
newRefResource :: Text -> Text -> RefResource
newRefResource Text
pName_ Text
pType_ =
  RefResource'
    { $sel:arn:RefResource' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:RefResource' :: Maybe Text
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedOn:RefResource' :: Maybe Text
lastUpdatedOn = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:RefResource' :: Maybe Text
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:RefResource' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:name:RefResource' :: Text
name = Text
pName_,
      $sel:type':RefResource' :: Text
type' = Text
pType_
    }

-- | The ARN of the experiment or launch.
refResource_arn :: Lens.Lens' RefResource (Prelude.Maybe Prelude.Text)
refResource_arn :: Lens' RefResource (Maybe Text)
refResource_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefResource' {Maybe Text
arn :: Maybe Text
$sel:arn:RefResource' :: RefResource -> Maybe Text
arn} -> Maybe Text
arn) (\s :: RefResource
s@RefResource' {} Maybe Text
a -> RefResource
s {$sel:arn:RefResource' :: Maybe Text
arn = Maybe Text
a} :: RefResource)

-- | The day and time that this experiment or launch ended.
refResource_endTime :: Lens.Lens' RefResource (Prelude.Maybe Prelude.Text)
refResource_endTime :: Lens' RefResource (Maybe Text)
refResource_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefResource' {Maybe Text
endTime :: Maybe Text
$sel:endTime:RefResource' :: RefResource -> Maybe Text
endTime} -> Maybe Text
endTime) (\s :: RefResource
s@RefResource' {} Maybe Text
a -> RefResource
s {$sel:endTime:RefResource' :: Maybe Text
endTime = Maybe Text
a} :: RefResource)

-- | The day and time that this experiment or launch was most recently
-- updated.
refResource_lastUpdatedOn :: Lens.Lens' RefResource (Prelude.Maybe Prelude.Text)
refResource_lastUpdatedOn :: Lens' RefResource (Maybe Text)
refResource_lastUpdatedOn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefResource' {Maybe Text
lastUpdatedOn :: Maybe Text
$sel:lastUpdatedOn:RefResource' :: RefResource -> Maybe Text
lastUpdatedOn} -> Maybe Text
lastUpdatedOn) (\s :: RefResource
s@RefResource' {} Maybe Text
a -> RefResource
s {$sel:lastUpdatedOn:RefResource' :: Maybe Text
lastUpdatedOn = Maybe Text
a} :: RefResource)

-- | The day and time that this experiment or launch started.
refResource_startTime :: Lens.Lens' RefResource (Prelude.Maybe Prelude.Text)
refResource_startTime :: Lens' RefResource (Maybe Text)
refResource_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefResource' {Maybe Text
startTime :: Maybe Text
$sel:startTime:RefResource' :: RefResource -> Maybe Text
startTime} -> Maybe Text
startTime) (\s :: RefResource
s@RefResource' {} Maybe Text
a -> RefResource
s {$sel:startTime:RefResource' :: Maybe Text
startTime = Maybe Text
a} :: RefResource)

-- | The status of the experiment or launch.
refResource_status :: Lens.Lens' RefResource (Prelude.Maybe Prelude.Text)
refResource_status :: Lens' RefResource (Maybe Text)
refResource_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefResource' {Maybe Text
status :: Maybe Text
$sel:status:RefResource' :: RefResource -> Maybe Text
status} -> Maybe Text
status) (\s :: RefResource
s@RefResource' {} Maybe Text
a -> RefResource
s {$sel:status:RefResource' :: Maybe Text
status = Maybe Text
a} :: RefResource)

-- | The name of the experiment or launch.
refResource_name :: Lens.Lens' RefResource Prelude.Text
refResource_name :: Lens' RefResource Text
refResource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefResource' {Text
name :: Text
$sel:name:RefResource' :: RefResource -> Text
name} -> Text
name) (\s :: RefResource
s@RefResource' {} Text
a -> RefResource
s {$sel:name:RefResource' :: Text
name = Text
a} :: RefResource)

-- | Specifies whether the resource that this structure contains information
-- about is an experiment or a launch.
refResource_type :: Lens.Lens' RefResource Prelude.Text
refResource_type :: Lens' RefResource Text
refResource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefResource' {Text
type' :: Text
$sel:type':RefResource' :: RefResource -> Text
type'} -> Text
type') (\s :: RefResource
s@RefResource' {} Text
a -> RefResource
s {$sel:type':RefResource' :: Text
type' = Text
a} :: RefResource)

instance Data.FromJSON RefResource where
  parseJSON :: Value -> Parser RefResource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RefResource"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> RefResource
RefResource'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"endTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastUpdatedOn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"startTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
      )

instance Prelude.Hashable RefResource where
  hashWithSalt :: Int -> RefResource -> Int
hashWithSalt Int
_salt RefResource' {Maybe Text
Text
type' :: Text
name :: Text
status :: Maybe Text
startTime :: Maybe Text
lastUpdatedOn :: Maybe Text
endTime :: Maybe Text
arn :: Maybe Text
$sel:type':RefResource' :: RefResource -> Text
$sel:name:RefResource' :: RefResource -> Text
$sel:status:RefResource' :: RefResource -> Maybe Text
$sel:startTime:RefResource' :: RefResource -> Maybe Text
$sel:lastUpdatedOn:RefResource' :: RefResource -> Maybe Text
$sel:endTime:RefResource' :: RefResource -> Maybe Text
$sel:arn:RefResource' :: RefResource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastUpdatedOn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
type'

instance Prelude.NFData RefResource where
  rnf :: RefResource -> ()
rnf RefResource' {Maybe Text
Text
type' :: Text
name :: Text
status :: Maybe Text
startTime :: Maybe Text
lastUpdatedOn :: Maybe Text
endTime :: Maybe Text
arn :: Maybe Text
$sel:type':RefResource' :: RefResource -> Text
$sel:name:RefResource' :: RefResource -> Text
$sel:status:RefResource' :: RefResource -> Maybe Text
$sel:startTime:RefResource' :: RefResource -> Maybe Text
$sel:lastUpdatedOn:RefResource' :: RefResource -> Maybe Text
$sel:endTime:RefResource' :: RefResource -> Maybe Text
$sel:arn:RefResource' :: RefResource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastUpdatedOn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
type'