{
  "name": "Article and Subscription tutorial",
  "models": [
    {
      "id": "article",
      "name": "Article",
      "kind": "entry",
      "description": "Editorial article content type.",
      "tags": [
        "editorial"
      ],
      "fields": [
        {
          "id": "title",
          "name": "Title",
          "type": "string",
          "required": true,
          "validations": {
            "minLength": 5,
            "maxLength": 100
          }
        },
        {
          "id": "slug",
          "name": "Slug",
          "type": "slug",
          "required": true,
          "editorial": {
            "helpText": "Used in URLs."
          }
        },
        {
          "id": "summary",
          "name": "Summary",
          "type": "text",
          "validations": {
            "maxLength": 250
          }
        },
        {
          "id": "body",
          "name": "Body",
          "type": "richText",
          "required": true,
          "richTextConfig": {
            "marks": [
              "bold",
              "italic",
              "link"
            ],
            "blocks": [
              "paragraph",
              "heading-2",
              "heading-3",
              "unordered-list",
              "ordered-list",
              "quote"
            ],
            "embeds": [
              {
                "kind": "asset"
              },
              {
                "kind": "reference",
                "targets": [
                  "person"
                ]
              }
            ]
          }
        },
        {
          "id": "hero_image",
          "name": "Hero Image",
          "type": "asset",
          "validations": {
            "mimeTypes": [
              "image/jpeg",
              "image/png"
            ]
          }
        },
        {
          "id": "author",
          "name": "Author",
          "type": "reference",
          "targets": [
            "person"
          ],
          "relation": {
            "ownership": "linked"
          }
        },
        {
          "id": "seo",
          "name": "SEO",
          "type": "object",
          "objectType": "seo-metadata",
          "translationHints": {
            "preferredRepresentation": "embedded"
          }
        },
        {
          "id": "article_type",
          "name": "Article Type",
          "type": "enum",
          "required": true,
          "values": [
            "internal",
            "external"
          ]
        },
        {
          "id": "source_url",
          "name": "Source URL",
          "type": "string"
        },
        {
          "id": "noindex",
          "name": "Exclude from Search",
          "type": "boolean"
        },
        {
          "id": "noindex_reason",
          "name": "Search Exclusion Reason",
          "type": "text"
        }
      ],
      "validationHints": [
        {
          "id": "external-requires-source",
          "description": "External articles must provide a source URL.",
          "when": {
            "field": "article_type",
            "equals": "external"
          },
          "then": {
            "require": [
              "source_url"
            ]
          }
        },
        {
          "id": "author-or-source",
          "description": "Provide at least one author or a source URL.",
          "then": {
            "atLeastOneOf": [
              "author",
              "source_url"
            ]
          }
        },
        {
          "id": "explain-noindex",
          "description": "Explain why an external article is excluded from search.",
          "severity": "warning",
          "when": {
            "allOf": [
              {
                "field": "article_type",
                "equals": "external"
              },
              {
                "not": {
                  "anyOf": [
                    {
                      "field": "noindex",
                      "isEmpty": true
                    },
                    {
                      "field": "noindex",
                      "equals": false
                    }
                  ]
                }
              }
            ]
          },
          "then": {
            "require": [
              "noindex_reason"
            ]
          }
        },
        {
          "id": "check-source-rights",
          "description": "Confirm permission to republish external source material.",
          "severity": "info"
        }
      ],
      "editorial": {
        "labelField": "title",
        "preview": {
          "title": "title",
          "description": "summary",
          "image": "hero_image"
        }
      },
      "governance": {
        "owner": "platform-team",
        "status": "active",
        "maturity": "stable"
      }
    },
    {
      "id": "page",
      "name": "Page",
      "kind": "entry",
      "description": "Generic page model for composed website content.",
      "fields": [
        {
          "id": "title",
          "name": "Title",
          "type": "string",
          "required": true
        },
        {
          "id": "slug",
          "name": "Slug",
          "type": "slug",
          "required": true
        },
        {
          "id": "page_type",
          "name": "Page Type",
          "type": "enum",
          "values": [
            "landing",
            "article",
            "standard"
          ],
          "default": "standard"
        },
        {
          "id": "hero_image",
          "name": "Hero Image",
          "type": "asset"
        },
        {
          "id": "seo",
          "name": "SEO",
          "type": "object",
          "objectType": "seo-metadata"
        },
        {
          "id": "related_articles",
          "name": "Related Articles",
          "type": "reference",
          "list": true,
          "targets": [
            "article"
          ],
          "relation": {
            "ordered": true,
            "uniqueItems": true,
            "ownership": "linked"
          }
        }
      ],
      "editorial": {
        "labelField": "title",
        "preview": {
          "title": "title",
          "image": "hero_image"
        }
      },
      "governance": {
        "owner": "platform-team",
        "status": "active",
        "maturity": "stable"
      }
    },
    {
      "id": "person",
      "name": "Person",
      "kind": "entry",
      "description": "Person profile content used for authorship and attribution.",
      "fields": [
        {
          "id": "full_name",
          "name": "Full Name",
          "type": "string",
          "required": true
        },
        {
          "id": "slug",
          "name": "Slug",
          "type": "slug",
          "required": true,
          "editorial": {
            "helpText": "Used in profile URLs."
          }
        },
        {
          "id": "bio",
          "name": "Biography",
          "type": "text"
        },
        {
          "id": "headshot",
          "name": "Headshot",
          "type": "asset",
          "validations": {
            "mimeTypes": [
              "image/jpeg",
              "image/png"
            ]
          }
        }
      ],
      "editorial": {
        "labelField": "full_name",
        "preview": {
          "title": "full_name",
          "description": "bio",
          "image": "headshot"
        }
      },
      "governance": {
        "owner": "platform-team",
        "status": "active",
        "maturity": "stable"
      }
    },
    {
      "id": "seo-metadata",
      "name": "SEO Metadata",
      "kind": "object",
      "description": "Reusable embedded SEO metadata structure.",
      "fields": [
        {
          "id": "meta_title",
          "name": "Meta Title",
          "type": "string",
          "validations": {
            "maxLength": 60
          }
        },
        {
          "id": "meta_description",
          "name": "Meta Description",
          "type": "text",
          "validations": {
            "maxLength": 160
          }
        },
        {
          "id": "canonical_url",
          "name": "Canonical URL",
          "type": "string"
        },
        {
          "id": "noindex",
          "name": "No Index",
          "type": "boolean",
          "default": false
        }
      ],
      "editorial": {
        "labelField": "meta_title"
      }
    },
    {
      "id": "subscription",
      "name": "Subscription",
      "kind": "entry",
      "description": "Illustrates a non-portable expression; CMMF does not execute it.",
      "fields": [
        {
          "id": "monthly_price",
          "type": "number",
          "required": true
        },
        {
          "id": "quarterly_price",
          "type": "number",
          "required": true
        }
      ],
      "validationHints": [
        {
          "id": "quarterly-price-bound",
          "description": "Quarterly price must exceed three times the monthly price.",
          "expression": {
            "dialect": "jsonlogic",
            "rule": {
              ">": [
                {
                  "var": "quarterly_price"
                },
                {
                  "*": [
                    3,
                    {
                      "var": "monthly_price"
                    }
                  ]
                }
              ]
            }
          }
        }
      ]
    }
  ]
}
