{-
   Alertmanager API
   API of the Prometheus Alertmanager (https://github.com/prometheus/alertmanager)

   OpenAPI spec version: 0.0.1

   NOTE: This file is auto generated by the openapi-generator.
   https://github.com/openapitools/openapi-generator.git
   Do not edit this file manually.
-}


module Data.AlertGroup exposing (AlertGroup, decoder, encoder)

import Data.GettableAlert as GettableAlert exposing (GettableAlert)
import Data.ReceiverReference as ReceiverReference exposing (ReceiverReference)
import Dict exposing (Dict)
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Pipeline exposing (optional, required)
import Json.Encode as Encode


type alias AlertGroup =
    { labels : Dict String String
    , receiver : ReceiverReference
    , alerts : List GettableAlert
    }


decoder : Decoder AlertGroup
decoder =
    Decode.succeed AlertGroup
        |> required "labels" (Decode.dict Decode.string)
        |> required "receiver" ReceiverReference.decoder
        |> required "alerts" (Decode.list GettableAlert.decoder)


encoder : AlertGroup -> Encode.Value
encoder model =
    Encode.object
        [ ( "labels", Encode.dict identity Encode.string model.labels )
        , ( "receiver", ReceiverReference.encoder model.receiver )
        , ( "alerts", Encode.list GettableAlert.encoder model.alerts )
        ]
