{-# LANGUAGE OverloadedStrings #-}

module Hydra.Sources.Tier4.Langs.Protobuf.SourceContext where

import Hydra.Sources.Tier3.All
import Hydra.Dsl.Types as Types
import Hydra.Dsl.Annotations
import Hydra.Dsl.Bootstrap


pbSourceContextNs :: Namespace
pbSourceContextNs = String -> Namespace
Namespace String
"hydra/langs/protobuf/sourceContext"
pbSourceContext :: String -> Type
pbSourceContext = Namespace -> String -> Type
typeref Namespace
pbSourceContextNs

protobufSourceContextModule :: Module
protobufSourceContextModule :: Module
protobufSourceContextModule = Namespace
-> [Element] -> [Module] -> [Module] -> Maybe String -> Module
Module Namespace
pbSourceContextNs [Element]
elements [Module
hydraCoreModule] [Module]
tier0Modules (Maybe String -> Module) -> Maybe String -> Module
forall a b. (a -> b) -> a -> b
$
    String -> Maybe String
forall a. a -> Maybe a
Just String
"Based on https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/source_context.proto"
  where
    def :: String -> Type -> Element
def = Namespace -> String -> Type -> Element
datatype Namespace
pbSourceContextNs

    elements :: [Element]
elements = [
--  // `SourceContext` represents information about the source of a
--  // protobuf element, like the file in which it is defined.
--  message SourceContext {
      String -> Type -> Element
def String
"SourceContext" (Type -> Element) -> Type -> Element
forall a b. (a -> b) -> a -> b
$
        String -> Type -> Type
doc (String
"`SourceContext` represents information about the source of a " String -> String -> String
forall a. [a] -> [a] -> [a]
++
             String
"protobuf element, like the file in which it is defined.") (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$
        [FieldType] -> Type
record [
--    // The path-qualified name of the .proto file that contained the associated
--    // protobuf element.  For example: `"google/protobuf/source_context.proto"`.
--    string file_name = 1;
          String
"fileName"String -> Type -> FieldType
>:
            String -> Type -> Type
doc (String
"The path-qualified name of the .proto file that contained the associated " String -> String -> String
forall a. [a] -> [a] -> [a]
++
                 String
"protobuf element.  For example: `\"google/protobuf/source_context.proto\"`.")
            Type
string]]
--  }