{-# 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.GameLift.Types.MatchmakingTicket
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GameLift.Types.MatchmakingTicket where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.GameSessionConnectionInfo
import Amazonka.GameLift.Types.MatchmakingConfigurationStatus
import Amazonka.GameLift.Types.Player
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Ticket generated to track the progress of a matchmaking request. Each
-- ticket is uniquely identified by a ticket ID, supplied by the requester,
-- when creating a matchmaking request with StartMatchmaking. Tickets can
-- be retrieved by calling DescribeMatchmaking with the ticket ID.
--
-- /See:/ 'newMatchmakingTicket' smart constructor.
data MatchmakingTicket = MatchmakingTicket'
  { -- | Current status of the matchmaking request.
    --
    -- -   __QUEUED__ -- The matchmaking request has been received and is
    --     currently waiting to be processed.
    --
    -- -   __SEARCHING__ -- The matchmaking request is currently being
    --     processed.
    --
    -- -   __REQUIRES_ACCEPTANCE__ -- A match has been proposed and the players
    --     must accept the match (see AcceptMatch). This status is used only
    --     with requests that use a matchmaking configuration with a player
    --     acceptance requirement.
    --
    -- -   __PLACING__ -- The FlexMatch engine has matched players and is in
    --     the process of placing a new game session for the match.
    --
    -- -   __COMPLETED__ -- Players have been matched and a game session is
    --     ready to host the players. A ticket in this state contains the
    --     necessary connection information for players.
    --
    -- -   __FAILED__ -- The matchmaking request was not completed.
    --
    -- -   __CANCELLED__ -- The matchmaking request was canceled. This may be
    --     the result of a call to StopMatchmaking or a proposed match that one
    --     or more players failed to accept.
    --
    -- -   __TIMED_OUT__ -- The matchmaking request was not successful within
    --     the duration specified in the matchmaking configuration.
    --
    -- Matchmaking requests that fail to successfully complete (statuses
    -- FAILED, CANCELLED, TIMED_OUT) can be resubmitted as new requests with
    -- new ticket IDs.
    MatchmakingTicket -> Maybe MatchmakingConfigurationStatus
status :: Prelude.Maybe MatchmakingConfigurationStatus,
    -- | Name of the MatchmakingConfiguration that is used with this ticket.
    -- Matchmaking configurations determine how players are grouped into a
    -- match and how a new game session is created for the match.
    MatchmakingTicket -> Maybe Text
configurationName :: Prelude.Maybe Prelude.Text,
    -- | Time stamp indicating when this matchmaking request was received. Format
    -- is a number expressed in Unix time as milliseconds (for example
    -- @\"1469498468.057\"@).
    MatchmakingTicket -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | Identifier and connection information of the game session created for
    -- the match. This information is added to the ticket only after the
    -- matchmaking request has been successfully completed. This parameter is
    -- not set when FlexMatch is being used without GameLift hosting.
    MatchmakingTicket -> Maybe GameSessionConnectionInfo
gameSessionConnectionInfo :: Prelude.Maybe GameSessionConnectionInfo,
    -- | A unique identifier for a matchmaking ticket.
    MatchmakingTicket -> Maybe Text
ticketId :: Prelude.Maybe Prelude.Text,
    -- | Average amount of time (in seconds) that players are currently waiting
    -- for a match. If there is not enough recent data, this property may be
    -- empty.
    MatchmakingTicket -> Maybe Natural
estimatedWaitTime :: Prelude.Maybe Prelude.Natural,
    -- | Additional information about the current status.
    MatchmakingTicket -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | Time stamp indicating when this matchmaking request stopped being
    -- processed due to success, failure, or cancellation. Format is a number
    -- expressed in Unix time as milliseconds (for example
    -- @\"1469498468.057\"@).
    MatchmakingTicket -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name
    -- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
    -- associated with the GameLift matchmaking configuration resource that is
    -- used with this ticket.
    MatchmakingTicket -> Maybe Text
configurationArn :: Prelude.Maybe Prelude.Text,
    -- | Code to explain the current status. For example, a status reason may
    -- indicate when a ticket has returned to @SEARCHING@ status after a
    -- proposed match fails to receive player acceptances.
    MatchmakingTicket -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text,
    -- | A set of @Player@ objects, each representing a player to find matches
    -- for. Players are identified by a unique player ID and may include
    -- latency data for use during matchmaking. If the ticket is in status
    -- @COMPLETED@, the @Player@ objects include the team the players were
    -- assigned to in the resulting match.
    MatchmakingTicket -> Maybe [Player]
players :: Prelude.Maybe [Player]
  }
  deriving (MatchmakingTicket -> MatchmakingTicket -> Bool
(MatchmakingTicket -> MatchmakingTicket -> Bool)
-> (MatchmakingTicket -> MatchmakingTicket -> Bool)
-> Eq MatchmakingTicket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MatchmakingTicket -> MatchmakingTicket -> Bool
$c/= :: MatchmakingTicket -> MatchmakingTicket -> Bool
== :: MatchmakingTicket -> MatchmakingTicket -> Bool
$c== :: MatchmakingTicket -> MatchmakingTicket -> Bool
Prelude.Eq, ReadPrec [MatchmakingTicket]
ReadPrec MatchmakingTicket
Int -> ReadS MatchmakingTicket
ReadS [MatchmakingTicket]
(Int -> ReadS MatchmakingTicket)
-> ReadS [MatchmakingTicket]
-> ReadPrec MatchmakingTicket
-> ReadPrec [MatchmakingTicket]
-> Read MatchmakingTicket
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MatchmakingTicket]
$creadListPrec :: ReadPrec [MatchmakingTicket]
readPrec :: ReadPrec MatchmakingTicket
$creadPrec :: ReadPrec MatchmakingTicket
readList :: ReadS [MatchmakingTicket]
$creadList :: ReadS [MatchmakingTicket]
readsPrec :: Int -> ReadS MatchmakingTicket
$creadsPrec :: Int -> ReadS MatchmakingTicket
Prelude.Read, Int -> MatchmakingTicket -> ShowS
[MatchmakingTicket] -> ShowS
MatchmakingTicket -> String
(Int -> MatchmakingTicket -> ShowS)
-> (MatchmakingTicket -> String)
-> ([MatchmakingTicket] -> ShowS)
-> Show MatchmakingTicket
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MatchmakingTicket] -> ShowS
$cshowList :: [MatchmakingTicket] -> ShowS
show :: MatchmakingTicket -> String
$cshow :: MatchmakingTicket -> String
showsPrec :: Int -> MatchmakingTicket -> ShowS
$cshowsPrec :: Int -> MatchmakingTicket -> ShowS
Prelude.Show, (forall x. MatchmakingTicket -> Rep MatchmakingTicket x)
-> (forall x. Rep MatchmakingTicket x -> MatchmakingTicket)
-> Generic MatchmakingTicket
forall x. Rep MatchmakingTicket x -> MatchmakingTicket
forall x. MatchmakingTicket -> Rep MatchmakingTicket x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MatchmakingTicket x -> MatchmakingTicket
$cfrom :: forall x. MatchmakingTicket -> Rep MatchmakingTicket x
Prelude.Generic)

-- |
-- Create a value of 'MatchmakingTicket' 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:
--
-- 'status', 'matchmakingTicket_status' - Current status of the matchmaking request.
--
-- -   __QUEUED__ -- The matchmaking request has been received and is
--     currently waiting to be processed.
--
-- -   __SEARCHING__ -- The matchmaking request is currently being
--     processed.
--
-- -   __REQUIRES_ACCEPTANCE__ -- A match has been proposed and the players
--     must accept the match (see AcceptMatch). This status is used only
--     with requests that use a matchmaking configuration with a player
--     acceptance requirement.
--
-- -   __PLACING__ -- The FlexMatch engine has matched players and is in
--     the process of placing a new game session for the match.
--
-- -   __COMPLETED__ -- Players have been matched and a game session is
--     ready to host the players. A ticket in this state contains the
--     necessary connection information for players.
--
-- -   __FAILED__ -- The matchmaking request was not completed.
--
-- -   __CANCELLED__ -- The matchmaking request was canceled. This may be
--     the result of a call to StopMatchmaking or a proposed match that one
--     or more players failed to accept.
--
-- -   __TIMED_OUT__ -- The matchmaking request was not successful within
--     the duration specified in the matchmaking configuration.
--
-- Matchmaking requests that fail to successfully complete (statuses
-- FAILED, CANCELLED, TIMED_OUT) can be resubmitted as new requests with
-- new ticket IDs.
--
-- 'configurationName', 'matchmakingTicket_configurationName' - Name of the MatchmakingConfiguration that is used with this ticket.
-- Matchmaking configurations determine how players are grouped into a
-- match and how a new game session is created for the match.
--
-- 'startTime', 'matchmakingTicket_startTime' - Time stamp indicating when this matchmaking request was received. Format
-- is a number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
--
-- 'gameSessionConnectionInfo', 'matchmakingTicket_gameSessionConnectionInfo' - Identifier and connection information of the game session created for
-- the match. This information is added to the ticket only after the
-- matchmaking request has been successfully completed. This parameter is
-- not set when FlexMatch is being used without GameLift hosting.
--
-- 'ticketId', 'matchmakingTicket_ticketId' - A unique identifier for a matchmaking ticket.
--
-- 'estimatedWaitTime', 'matchmakingTicket_estimatedWaitTime' - Average amount of time (in seconds) that players are currently waiting
-- for a match. If there is not enough recent data, this property may be
-- empty.
--
-- 'statusMessage', 'matchmakingTicket_statusMessage' - Additional information about the current status.
--
-- 'endTime', 'matchmakingTicket_endTime' - Time stamp indicating when this matchmaking request stopped being
-- processed due to success, failure, or cancellation. Format is a number
-- expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
--
-- 'configurationArn', 'matchmakingTicket_configurationArn' - The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- associated with the GameLift matchmaking configuration resource that is
-- used with this ticket.
--
-- 'statusReason', 'matchmakingTicket_statusReason' - Code to explain the current status. For example, a status reason may
-- indicate when a ticket has returned to @SEARCHING@ status after a
-- proposed match fails to receive player acceptances.
--
-- 'players', 'matchmakingTicket_players' - A set of @Player@ objects, each representing a player to find matches
-- for. Players are identified by a unique player ID and may include
-- latency data for use during matchmaking. If the ticket is in status
-- @COMPLETED@, the @Player@ objects include the team the players were
-- assigned to in the resulting match.
newMatchmakingTicket ::
  MatchmakingTicket
newMatchmakingTicket :: MatchmakingTicket
newMatchmakingTicket =
  MatchmakingTicket' :: Maybe MatchmakingConfigurationStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe GameSessionConnectionInfo
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe [Player]
-> MatchmakingTicket
MatchmakingTicket'
    { $sel:status:MatchmakingTicket' :: Maybe MatchmakingConfigurationStatus
status = Maybe MatchmakingConfigurationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationName:MatchmakingTicket' :: Maybe Text
configurationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:MatchmakingTicket' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:gameSessionConnectionInfo:MatchmakingTicket' :: Maybe GameSessionConnectionInfo
gameSessionConnectionInfo = Maybe GameSessionConnectionInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:ticketId:MatchmakingTicket' :: Maybe Text
ticketId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedWaitTime:MatchmakingTicket' :: Maybe Natural
estimatedWaitTime = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:MatchmakingTicket' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:MatchmakingTicket' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationArn:MatchmakingTicket' :: Maybe Text
configurationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusReason:MatchmakingTicket' :: Maybe Text
statusReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:players:MatchmakingTicket' :: Maybe [Player]
players = Maybe [Player]
forall a. Maybe a
Prelude.Nothing
    }

-- | Current status of the matchmaking request.
--
-- -   __QUEUED__ -- The matchmaking request has been received and is
--     currently waiting to be processed.
--
-- -   __SEARCHING__ -- The matchmaking request is currently being
--     processed.
--
-- -   __REQUIRES_ACCEPTANCE__ -- A match has been proposed and the players
--     must accept the match (see AcceptMatch). This status is used only
--     with requests that use a matchmaking configuration with a player
--     acceptance requirement.
--
-- -   __PLACING__ -- The FlexMatch engine has matched players and is in
--     the process of placing a new game session for the match.
--
-- -   __COMPLETED__ -- Players have been matched and a game session is
--     ready to host the players. A ticket in this state contains the
--     necessary connection information for players.
--
-- -   __FAILED__ -- The matchmaking request was not completed.
--
-- -   __CANCELLED__ -- The matchmaking request was canceled. This may be
--     the result of a call to StopMatchmaking or a proposed match that one
--     or more players failed to accept.
--
-- -   __TIMED_OUT__ -- The matchmaking request was not successful within
--     the duration specified in the matchmaking configuration.
--
-- Matchmaking requests that fail to successfully complete (statuses
-- FAILED, CANCELLED, TIMED_OUT) can be resubmitted as new requests with
-- new ticket IDs.
matchmakingTicket_status :: Lens.Lens' MatchmakingTicket (Prelude.Maybe MatchmakingConfigurationStatus)
matchmakingTicket_status :: (Maybe MatchmakingConfigurationStatus
 -> f (Maybe MatchmakingConfigurationStatus))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_status = (MatchmakingTicket -> Maybe MatchmakingConfigurationStatus)
-> (MatchmakingTicket
    -> Maybe MatchmakingConfigurationStatus -> MatchmakingTicket)
-> Lens
     MatchmakingTicket
     MatchmakingTicket
     (Maybe MatchmakingConfigurationStatus)
     (Maybe MatchmakingConfigurationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe MatchmakingConfigurationStatus
status :: Maybe MatchmakingConfigurationStatus
$sel:status:MatchmakingTicket' :: MatchmakingTicket -> Maybe MatchmakingConfigurationStatus
status} -> Maybe MatchmakingConfigurationStatus
status) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe MatchmakingConfigurationStatus
a -> MatchmakingTicket
s {$sel:status:MatchmakingTicket' :: Maybe MatchmakingConfigurationStatus
status = Maybe MatchmakingConfigurationStatus
a} :: MatchmakingTicket)

-- | Name of the MatchmakingConfiguration that is used with this ticket.
-- Matchmaking configurations determine how players are grouped into a
-- match and how a new game session is created for the match.
matchmakingTicket_configurationName :: Lens.Lens' MatchmakingTicket (Prelude.Maybe Prelude.Text)
matchmakingTicket_configurationName :: (Maybe Text -> f (Maybe Text))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_configurationName = (MatchmakingTicket -> Maybe Text)
-> (MatchmakingTicket -> Maybe Text -> MatchmakingTicket)
-> Lens
     MatchmakingTicket MatchmakingTicket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe Text
configurationName :: Maybe Text
$sel:configurationName:MatchmakingTicket' :: MatchmakingTicket -> Maybe Text
configurationName} -> Maybe Text
configurationName) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe Text
a -> MatchmakingTicket
s {$sel:configurationName:MatchmakingTicket' :: Maybe Text
configurationName = Maybe Text
a} :: MatchmakingTicket)

-- | Time stamp indicating when this matchmaking request was received. Format
-- is a number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
matchmakingTicket_startTime :: Lens.Lens' MatchmakingTicket (Prelude.Maybe Prelude.UTCTime)
matchmakingTicket_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_startTime = (MatchmakingTicket -> Maybe POSIX)
-> (MatchmakingTicket -> Maybe POSIX -> MatchmakingTicket)
-> Lens
     MatchmakingTicket MatchmakingTicket (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:MatchmakingTicket' :: MatchmakingTicket -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe POSIX
a -> MatchmakingTicket
s {$sel:startTime:MatchmakingTicket' :: Maybe POSIX
startTime = Maybe POSIX
a} :: MatchmakingTicket) ((Maybe POSIX -> f (Maybe POSIX))
 -> MatchmakingTicket -> f MatchmakingTicket)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MatchmakingTicket
-> f MatchmakingTicket
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Identifier and connection information of the game session created for
-- the match. This information is added to the ticket only after the
-- matchmaking request has been successfully completed. This parameter is
-- not set when FlexMatch is being used without GameLift hosting.
matchmakingTicket_gameSessionConnectionInfo :: Lens.Lens' MatchmakingTicket (Prelude.Maybe GameSessionConnectionInfo)
matchmakingTicket_gameSessionConnectionInfo :: (Maybe GameSessionConnectionInfo
 -> f (Maybe GameSessionConnectionInfo))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_gameSessionConnectionInfo = (MatchmakingTicket -> Maybe GameSessionConnectionInfo)
-> (MatchmakingTicket
    -> Maybe GameSessionConnectionInfo -> MatchmakingTicket)
-> Lens
     MatchmakingTicket
     MatchmakingTicket
     (Maybe GameSessionConnectionInfo)
     (Maybe GameSessionConnectionInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe GameSessionConnectionInfo
gameSessionConnectionInfo :: Maybe GameSessionConnectionInfo
$sel:gameSessionConnectionInfo:MatchmakingTicket' :: MatchmakingTicket -> Maybe GameSessionConnectionInfo
gameSessionConnectionInfo} -> Maybe GameSessionConnectionInfo
gameSessionConnectionInfo) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe GameSessionConnectionInfo
a -> MatchmakingTicket
s {$sel:gameSessionConnectionInfo:MatchmakingTicket' :: Maybe GameSessionConnectionInfo
gameSessionConnectionInfo = Maybe GameSessionConnectionInfo
a} :: MatchmakingTicket)

-- | A unique identifier for a matchmaking ticket.
matchmakingTicket_ticketId :: Lens.Lens' MatchmakingTicket (Prelude.Maybe Prelude.Text)
matchmakingTicket_ticketId :: (Maybe Text -> f (Maybe Text))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_ticketId = (MatchmakingTicket -> Maybe Text)
-> (MatchmakingTicket -> Maybe Text -> MatchmakingTicket)
-> Lens
     MatchmakingTicket MatchmakingTicket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe Text
ticketId :: Maybe Text
$sel:ticketId:MatchmakingTicket' :: MatchmakingTicket -> Maybe Text
ticketId} -> Maybe Text
ticketId) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe Text
a -> MatchmakingTicket
s {$sel:ticketId:MatchmakingTicket' :: Maybe Text
ticketId = Maybe Text
a} :: MatchmakingTicket)

-- | Average amount of time (in seconds) that players are currently waiting
-- for a match. If there is not enough recent data, this property may be
-- empty.
matchmakingTicket_estimatedWaitTime :: Lens.Lens' MatchmakingTicket (Prelude.Maybe Prelude.Natural)
matchmakingTicket_estimatedWaitTime :: (Maybe Natural -> f (Maybe Natural))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_estimatedWaitTime = (MatchmakingTicket -> Maybe Natural)
-> (MatchmakingTicket -> Maybe Natural -> MatchmakingTicket)
-> Lens
     MatchmakingTicket MatchmakingTicket (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe Natural
estimatedWaitTime :: Maybe Natural
$sel:estimatedWaitTime:MatchmakingTicket' :: MatchmakingTicket -> Maybe Natural
estimatedWaitTime} -> Maybe Natural
estimatedWaitTime) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe Natural
a -> MatchmakingTicket
s {$sel:estimatedWaitTime:MatchmakingTicket' :: Maybe Natural
estimatedWaitTime = Maybe Natural
a} :: MatchmakingTicket)

-- | Additional information about the current status.
matchmakingTicket_statusMessage :: Lens.Lens' MatchmakingTicket (Prelude.Maybe Prelude.Text)
matchmakingTicket_statusMessage :: (Maybe Text -> f (Maybe Text))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_statusMessage = (MatchmakingTicket -> Maybe Text)
-> (MatchmakingTicket -> Maybe Text -> MatchmakingTicket)
-> Lens
     MatchmakingTicket MatchmakingTicket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:MatchmakingTicket' :: MatchmakingTicket -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe Text
a -> MatchmakingTicket
s {$sel:statusMessage:MatchmakingTicket' :: Maybe Text
statusMessage = Maybe Text
a} :: MatchmakingTicket)

-- | Time stamp indicating when this matchmaking request stopped being
-- processed due to success, failure, or cancellation. Format is a number
-- expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
matchmakingTicket_endTime :: Lens.Lens' MatchmakingTicket (Prelude.Maybe Prelude.UTCTime)
matchmakingTicket_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_endTime = (MatchmakingTicket -> Maybe POSIX)
-> (MatchmakingTicket -> Maybe POSIX -> MatchmakingTicket)
-> Lens
     MatchmakingTicket MatchmakingTicket (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:MatchmakingTicket' :: MatchmakingTicket -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe POSIX
a -> MatchmakingTicket
s {$sel:endTime:MatchmakingTicket' :: Maybe POSIX
endTime = Maybe POSIX
a} :: MatchmakingTicket) ((Maybe POSIX -> f (Maybe POSIX))
 -> MatchmakingTicket -> f MatchmakingTicket)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MatchmakingTicket
-> f MatchmakingTicket
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- associated with the GameLift matchmaking configuration resource that is
-- used with this ticket.
matchmakingTicket_configurationArn :: Lens.Lens' MatchmakingTicket (Prelude.Maybe Prelude.Text)
matchmakingTicket_configurationArn :: (Maybe Text -> f (Maybe Text))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_configurationArn = (MatchmakingTicket -> Maybe Text)
-> (MatchmakingTicket -> Maybe Text -> MatchmakingTicket)
-> Lens
     MatchmakingTicket MatchmakingTicket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe Text
configurationArn :: Maybe Text
$sel:configurationArn:MatchmakingTicket' :: MatchmakingTicket -> Maybe Text
configurationArn} -> Maybe Text
configurationArn) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe Text
a -> MatchmakingTicket
s {$sel:configurationArn:MatchmakingTicket' :: Maybe Text
configurationArn = Maybe Text
a} :: MatchmakingTicket)

-- | Code to explain the current status. For example, a status reason may
-- indicate when a ticket has returned to @SEARCHING@ status after a
-- proposed match fails to receive player acceptances.
matchmakingTicket_statusReason :: Lens.Lens' MatchmakingTicket (Prelude.Maybe Prelude.Text)
matchmakingTicket_statusReason :: (Maybe Text -> f (Maybe Text))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_statusReason = (MatchmakingTicket -> Maybe Text)
-> (MatchmakingTicket -> Maybe Text -> MatchmakingTicket)
-> Lens
     MatchmakingTicket MatchmakingTicket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:MatchmakingTicket' :: MatchmakingTicket -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe Text
a -> MatchmakingTicket
s {$sel:statusReason:MatchmakingTicket' :: Maybe Text
statusReason = Maybe Text
a} :: MatchmakingTicket)

-- | A set of @Player@ objects, each representing a player to find matches
-- for. Players are identified by a unique player ID and may include
-- latency data for use during matchmaking. If the ticket is in status
-- @COMPLETED@, the @Player@ objects include the team the players were
-- assigned to in the resulting match.
matchmakingTicket_players :: Lens.Lens' MatchmakingTicket (Prelude.Maybe [Player])
matchmakingTicket_players :: (Maybe [Player] -> f (Maybe [Player]))
-> MatchmakingTicket -> f MatchmakingTicket
matchmakingTicket_players = (MatchmakingTicket -> Maybe [Player])
-> (MatchmakingTicket -> Maybe [Player] -> MatchmakingTicket)
-> Lens
     MatchmakingTicket
     MatchmakingTicket
     (Maybe [Player])
     (Maybe [Player])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MatchmakingTicket' {Maybe [Player]
players :: Maybe [Player]
$sel:players:MatchmakingTicket' :: MatchmakingTicket -> Maybe [Player]
players} -> Maybe [Player]
players) (\s :: MatchmakingTicket
s@MatchmakingTicket' {} Maybe [Player]
a -> MatchmakingTicket
s {$sel:players:MatchmakingTicket' :: Maybe [Player]
players = Maybe [Player]
a} :: MatchmakingTicket) ((Maybe [Player] -> f (Maybe [Player]))
 -> MatchmakingTicket -> f MatchmakingTicket)
-> ((Maybe [Player] -> f (Maybe [Player]))
    -> Maybe [Player] -> f (Maybe [Player]))
-> (Maybe [Player] -> f (Maybe [Player]))
-> MatchmakingTicket
-> f MatchmakingTicket
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Player] [Player] [Player] [Player]
-> Iso
     (Maybe [Player]) (Maybe [Player]) (Maybe [Player]) (Maybe [Player])
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 AnIso [Player] [Player] [Player] [Player]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON MatchmakingTicket where
  parseJSON :: Value -> Parser MatchmakingTicket
parseJSON =
    String
-> (Object -> Parser MatchmakingTicket)
-> Value
-> Parser MatchmakingTicket
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MatchmakingTicket"
      ( \Object
x ->
          Maybe MatchmakingConfigurationStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe GameSessionConnectionInfo
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe [Player]
-> MatchmakingTicket
MatchmakingTicket'
            (Maybe MatchmakingConfigurationStatus
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe GameSessionConnectionInfo
 -> Maybe Text
 -> Maybe Natural
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Player]
 -> MatchmakingTicket)
-> Parser (Maybe MatchmakingConfigurationStatus)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe GameSessionConnectionInfo
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Player]
      -> MatchmakingTicket)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MatchmakingConfigurationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe GameSessionConnectionInfo
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Player]
   -> MatchmakingTicket)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe GameSessionConnectionInfo
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Player]
      -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConfigurationName")
            Parser
  (Maybe POSIX
   -> Maybe GameSessionConnectionInfo
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Player]
   -> MatchmakingTicket)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe GameSessionConnectionInfo
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Player]
      -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
            Parser
  (Maybe GameSessionConnectionInfo
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Player]
   -> MatchmakingTicket)
-> Parser (Maybe GameSessionConnectionInfo)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Player]
      -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe GameSessionConnectionInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GameSessionConnectionInfo")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Player]
   -> MatchmakingTicket)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Player]
      -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TicketId")
            Parser
  (Maybe Natural
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Player]
   -> MatchmakingTicket)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Player]
      -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EstimatedWaitTime")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Player]
   -> MatchmakingTicket)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe [Player] -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusMessage")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe [Player] -> MatchmakingTicket)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe [Player] -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndTime")
            Parser
  (Maybe Text -> Maybe Text -> Maybe [Player] -> MatchmakingTicket)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Player] -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConfigurationArn")
            Parser (Maybe Text -> Maybe [Player] -> MatchmakingTicket)
-> Parser (Maybe Text)
-> Parser (Maybe [Player] -> MatchmakingTicket)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusReason")
            Parser (Maybe [Player] -> MatchmakingTicket)
-> Parser (Maybe [Player]) -> Parser MatchmakingTicket
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Player]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Players" Parser (Maybe (Maybe [Player]))
-> Maybe [Player] -> Parser (Maybe [Player])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Player]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable MatchmakingTicket

instance Prelude.NFData MatchmakingTicket