from relationalai.semantics.frontend.base import Field, Library
from relationalai.semantics import metamodel as mm
from relationalai.semantics.metamodel.builtins import builtins as bt

library = Library("lqp")

Symbol = library.Type("Symbol")
mm_Symbol = bt.lqp.Symbol
assert isinstance(mm_Symbol, mm.TypeNode)

export = library.Relation("export", [])
external = library.Relation("external", [])
from_cdc = library.Relation("from_cdc", [])
adhoc = library.Relation("adhoc", [])
track = library.Relation("track", [Field.input("library", Symbol), Field.input("relation", Symbol)])

_recursion_config_relation = mm.Relation("recursion_config", (mm.Field("recursion_type", mm_Symbol),))
require_seminaive = mm.Annotation(relation=_recursion_config_relation, args=(mm.Literal(mm_Symbol, "require_seminaive"),))
