{
    "$schema": "../../../../schemas/diagram-spec.schema.json",
    "schemaVersion": "2.0",
    "diagramKind": "er",
    "id": "editorial-catalog-er",
    "title": "Editorial Catalog — Logical ER",
    "description": "Logical relational structure for articles, revisions, tags, and their stable references.",
    "language": "en",
    "nodes": [
        {
            "id": "articles",
            "type": "entity",
            "title": "Article",
            "description": "Editorial content identity.",
            "attributes": [
                {
                    "id": "article-id",
                    "name": "id",
                    "dataType": "uuid",
                    "nullable": false
                },
                {
                    "id": "article-slug",
                    "name": "slug",
                    "dataType": "text",
                    "nullable": false
                },
                {
                    "id": "article-title",
                    "name": "title",
                    "dataType": "text",
                    "nullable": false
                }
            ],
            "primaryKey": {
                "id": "articles-pk",
                "attributeIds": [
                    "article-id"
                ]
            },
            "uniqueKeys": [
                {
                    "id": "articles-slug-uk",
                    "attributeIds": [
                        "article-slug"
                    ]
                }
            ]
        },
        {
            "id": "revisions",
            "type": "entity",
            "title": "Revision",
            "description": "Versioned article body.",
            "attributes": [
                {
                    "id": "revision-article-id",
                    "name": "article_id",
                    "dataType": "uuid",
                    "nullable": false
                },
                {
                    "id": "revision-number",
                    "name": "revision_no",
                    "dataType": "integer",
                    "nullable": false
                },
                {
                    "id": "revision-body",
                    "name": "body",
                    "dataType": "text",
                    "nullable": false
                }
            ],
            "primaryKey": {
                "id": "revisions-pk",
                "attributeIds": [
                    "revision-article-id",
                    "revision-number"
                ]
            },
            "uniqueKeys": []
        },
        {
            "id": "tags",
            "type": "entity",
            "title": "Tag",
            "description": "Reusable editorial classification.",
            "attributes": [
                {
                    "id": "tag-id",
                    "name": "id",
                    "dataType": "uuid",
                    "nullable": false
                },
                {
                    "id": "tag-name",
                    "name": "name",
                    "dataType": "text",
                    "nullable": false
                }
            ],
            "primaryKey": {
                "id": "tags-pk",
                "attributeIds": [
                    "tag-id"
                ]
            },
            "uniqueKeys": [
                {
                    "id": "tags-name-uk",
                    "attributeIds": [
                        "tag-name"
                    ]
                }
            ]
        },
        {
            "id": "article-tags",
            "type": "entity",
            "title": "Article Tag",
            "description": "Identifying article-to-tag membership.",
            "attributes": [
                {
                    "id": "article-tag-article-id",
                    "name": "article_id",
                    "dataType": "uuid",
                    "nullable": false
                },
                {
                    "id": "article-tag-tag-id",
                    "name": "tag_id",
                    "dataType": "uuid",
                    "nullable": false
                }
            ],
            "primaryKey": {
                "id": "article-tags-pk",
                "attributeIds": [
                    "article-tag-article-id",
                    "article-tag-tag-id"
                ]
            },
            "uniqueKeys": []
        }
    ],
    "edges": [
        {
            "id": "article-revisions-fk",
            "type": "foreign-key",
            "from": "revisions",
            "to": "articles",
            "title": "has revisions",
            "fromAttributeIds": [
                "revision-article-id"
            ],
            "toAttributeIds": [
                "article-id"
            ],
            "fromCardinality": "zero-or-many",
            "toCardinality": "one",
            "identifying": true
        },
        {
            "id": "article-tags-article-fk",
            "type": "foreign-key",
            "from": "article-tags",
            "to": "articles",
            "title": "classifies article",
            "fromAttributeIds": [
                "article-tag-article-id"
            ],
            "toAttributeIds": [
                "article-id"
            ],
            "fromCardinality": "zero-or-many",
            "toCardinality": "one",
            "identifying": true
        },
        {
            "id": "article-tags-tag-fk",
            "type": "foreign-key",
            "from": "article-tags",
            "to": "tags",
            "title": "uses tag",
            "fromAttributeIds": [
                "article-tag-tag-id"
            ],
            "toAttributeIds": [
                "tag-id"
            ],
            "fromCardinality": "zero-or-many",
            "toCardinality": "one",
            "identifying": true
        }
    ]
}
