{-# 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.ScheduledSplitsLaunchDefinition
-- 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.ScheduledSplitsLaunchDefinition where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Evidently.Types.ScheduledSplit
import qualified Amazonka.Prelude as Prelude

-- | An array of structures that define the traffic allocation percentages
-- among the feature variations during each step of a launch. This also
-- defines the start time of each step.
--
-- /See:/ 'newScheduledSplitsLaunchDefinition' smart constructor.
data ScheduledSplitsLaunchDefinition = ScheduledSplitsLaunchDefinition'
  { -- | An array of structures that define the traffic allocation percentages
    -- among the feature variations during each step of the launch. This also
    -- defines the start time of each step.
    ScheduledSplitsLaunchDefinition -> Maybe (NonEmpty ScheduledSplit)
steps :: Prelude.Maybe (Prelude.NonEmpty ScheduledSplit)
  }
  deriving (ScheduledSplitsLaunchDefinition
-> ScheduledSplitsLaunchDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduledSplitsLaunchDefinition
-> ScheduledSplitsLaunchDefinition -> Bool
$c/= :: ScheduledSplitsLaunchDefinition
-> ScheduledSplitsLaunchDefinition -> Bool
== :: ScheduledSplitsLaunchDefinition
-> ScheduledSplitsLaunchDefinition -> Bool
$c== :: ScheduledSplitsLaunchDefinition
-> ScheduledSplitsLaunchDefinition -> Bool
Prelude.Eq, ReadPrec [ScheduledSplitsLaunchDefinition]
ReadPrec ScheduledSplitsLaunchDefinition
Int -> ReadS ScheduledSplitsLaunchDefinition
ReadS [ScheduledSplitsLaunchDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduledSplitsLaunchDefinition]
$creadListPrec :: ReadPrec [ScheduledSplitsLaunchDefinition]
readPrec :: ReadPrec ScheduledSplitsLaunchDefinition
$creadPrec :: ReadPrec ScheduledSplitsLaunchDefinition
readList :: ReadS [ScheduledSplitsLaunchDefinition]
$creadList :: ReadS [ScheduledSplitsLaunchDefinition]
readsPrec :: Int -> ReadS ScheduledSplitsLaunchDefinition
$creadsPrec :: Int -> ReadS ScheduledSplitsLaunchDefinition
Prelude.Read, Int -> ScheduledSplitsLaunchDefinition -> ShowS
[ScheduledSplitsLaunchDefinition] -> ShowS
ScheduledSplitsLaunchDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduledSplitsLaunchDefinition] -> ShowS
$cshowList :: [ScheduledSplitsLaunchDefinition] -> ShowS
show :: ScheduledSplitsLaunchDefinition -> String
$cshow :: ScheduledSplitsLaunchDefinition -> String
showsPrec :: Int -> ScheduledSplitsLaunchDefinition -> ShowS
$cshowsPrec :: Int -> ScheduledSplitsLaunchDefinition -> ShowS
Prelude.Show, forall x.
Rep ScheduledSplitsLaunchDefinition x
-> ScheduledSplitsLaunchDefinition
forall x.
ScheduledSplitsLaunchDefinition
-> Rep ScheduledSplitsLaunchDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScheduledSplitsLaunchDefinition x
-> ScheduledSplitsLaunchDefinition
$cfrom :: forall x.
ScheduledSplitsLaunchDefinition
-> Rep ScheduledSplitsLaunchDefinition x
Prelude.Generic)

-- |
-- Create a value of 'ScheduledSplitsLaunchDefinition' 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:
--
-- 'steps', 'scheduledSplitsLaunchDefinition_steps' - An array of structures that define the traffic allocation percentages
-- among the feature variations during each step of the launch. This also
-- defines the start time of each step.
newScheduledSplitsLaunchDefinition ::
  ScheduledSplitsLaunchDefinition
newScheduledSplitsLaunchDefinition :: ScheduledSplitsLaunchDefinition
newScheduledSplitsLaunchDefinition =
  ScheduledSplitsLaunchDefinition'
    { $sel:steps:ScheduledSplitsLaunchDefinition' :: Maybe (NonEmpty ScheduledSplit)
steps =
        forall a. Maybe a
Prelude.Nothing
    }

-- | An array of structures that define the traffic allocation percentages
-- among the feature variations during each step of the launch. This also
-- defines the start time of each step.
scheduledSplitsLaunchDefinition_steps :: Lens.Lens' ScheduledSplitsLaunchDefinition (Prelude.Maybe (Prelude.NonEmpty ScheduledSplit))
scheduledSplitsLaunchDefinition_steps :: Lens'
  ScheduledSplitsLaunchDefinition (Maybe (NonEmpty ScheduledSplit))
scheduledSplitsLaunchDefinition_steps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledSplitsLaunchDefinition' {Maybe (NonEmpty ScheduledSplit)
steps :: Maybe (NonEmpty ScheduledSplit)
$sel:steps:ScheduledSplitsLaunchDefinition' :: ScheduledSplitsLaunchDefinition -> Maybe (NonEmpty ScheduledSplit)
steps} -> Maybe (NonEmpty ScheduledSplit)
steps) (\s :: ScheduledSplitsLaunchDefinition
s@ScheduledSplitsLaunchDefinition' {} Maybe (NonEmpty ScheduledSplit)
a -> ScheduledSplitsLaunchDefinition
s {$sel:steps:ScheduledSplitsLaunchDefinition' :: Maybe (NonEmpty ScheduledSplit)
steps = Maybe (NonEmpty ScheduledSplit)
a} :: ScheduledSplitsLaunchDefinition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromJSON
    ScheduledSplitsLaunchDefinition
  where
  parseJSON :: Value -> Parser ScheduledSplitsLaunchDefinition
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScheduledSplitsLaunchDefinition"
      ( \Object
x ->
          Maybe (NonEmpty ScheduledSplit) -> ScheduledSplitsLaunchDefinition
ScheduledSplitsLaunchDefinition'
            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
"steps")
      )

instance
  Prelude.Hashable
    ScheduledSplitsLaunchDefinition
  where
  hashWithSalt :: Int -> ScheduledSplitsLaunchDefinition -> Int
hashWithSalt
    Int
_salt
    ScheduledSplitsLaunchDefinition' {Maybe (NonEmpty ScheduledSplit)
steps :: Maybe (NonEmpty ScheduledSplit)
$sel:steps:ScheduledSplitsLaunchDefinition' :: ScheduledSplitsLaunchDefinition -> Maybe (NonEmpty ScheduledSplit)
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ScheduledSplit)
steps

instance
  Prelude.NFData
    ScheduledSplitsLaunchDefinition
  where
  rnf :: ScheduledSplitsLaunchDefinition -> ()
rnf ScheduledSplitsLaunchDefinition' {Maybe (NonEmpty ScheduledSplit)
steps :: Maybe (NonEmpty ScheduledSplit)
$sel:steps:ScheduledSplitsLaunchDefinition' :: ScheduledSplitsLaunchDefinition -> Maybe (NonEmpty ScheduledSplit)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ScheduledSplit)
steps