defmodule Plato do @moduledoc """ Plato - A declarative content management library for Elixir. Define content schemas using a simple DSL and get automatic management capabilities. ## Quick Start # 1. Define your schemas defmodule MyApp.Schemas do use Plato.DSL schema "Article" do field :title, :text, required: true field :body, :text field :published, :boolean end end # 2. Register them on startup MyApp.Schemas.schemas() |> Enum.each(&Plato.register_schema/1) # 3. Use them Plato.list_schemas() #=> [%Plato.Schema{name: "Article", ...}] Plato.get_schema("Article") #=> %Plato.Schema{name: "Article", fields: [...]} ## Available Field Types Plato supports the following field types: #{Plato.Schema.valid_types() |> Enum.map(&" * `#{inspect(&1)}`") |> Enum.join("\n")} For detailed information about each type, see `Plato.Schema`. ## Architecture - **`Plato.Schema`** - Data structure for content types - **`Plato.DSL`** - Macro-based schema definition language - **`Plato.Registry`** - Agent-based schema storage ## Main API This module provides convenient functions that delegate to the Registry: - `register_schema/1` - Add a schema to the registry - `get_schema/1` - Retrieve a schema by name - `list_schemas/0` - Get all registered schemas For the full DSL documentation, see `Plato.DSL`. """ @doc """ Registers a schema in the registry. """ defdelegate register_schema(schema), to: Plato.Registry @doc """ Gets a schema by name. """ defdelegate get_schema(name), to: Plato.Registry @doc """ Lists all registered schemas. """ defdelegate list_schemas(), to: Plato.Registry end