{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$id": "https://raw.githubusercontent.com/WordPress/secure-custom-fields/trunk/schemas/post-type.schema.json",
	"title": "SCF Post Type(s)",
	"description": "Schema for Secure Custom Fields post type definitions - accepts single object or array. Properties marked '[SCF Export Only]' are preserved during export but not used functionally during import.",
	"oneOf": [
		{
			"description": "Single post type object",
			"$ref": "#/definitions/postType"
		},
		{
			"description": "Array of post type objects (export format)",
			"type": "array",
			"items": { "$ref": "#/definitions/postType" },
			"minItems": 1
		}
	],
	"definitions": {
		"postType": {
			"type": "object",
			"required": [ "key", "title", "post_type" ],
			"additionalProperties": false,
			"properties": {
				"key": {
					"type": "string",
					"pattern": "^post_type_.+$",
					"minLength": 1,
					"description": "Unique identifier for the post type with post_type_ prefix (e.g. 'post_type_book')"
				},
				"title": { "$ref": "common.schema.json#/definitions/title" },
				"post_type": {
					"type": "string",
					"pattern": "^[a-z0-9_-]+$",
					"minLength": 1,
					"maxLength": 20,
					"not": {
						"$ref": "common.schema.json#/definitions/wordpressReservedTerms"
					},
					"description": "The post type key passed to register_post_type() (e.g. 'book', 'product'). Max 20 characters, lowercase letters/numbers/underscores/dashes only, cannot be WordPress reserved terms."
				},
				"menu_order": { "$ref": "common.schema.json#/definitions/menu_order" },
				"active": { "$ref": "common.schema.json#/definitions/active" },
				"advanced_configuration": { "$ref": "common.schema.json#/definitions/advanced_configuration" },
				"modified": { "$ref": "common.schema.json#/definitions/modified" },
				"import_source": { "$ref": "common.schema.json#/definitions/import_source" },
				"import_date": { "$ref": "common.schema.json#/definitions/import_date" },

				"labels": {
					"type": "object",
					"description": "Labels for the post type in various contexts. If omitted, WordPress auto-generates labels from 'title'.",
					"additionalProperties": false,
					"properties": {
						"name": {
							"type": "string",
							"description": "General name for the post type, usually plural"
						},
						"singular_name": {
							"type": "string",
							"description": "Name for one object of this post type"
						},
						"menu_name": {
							"type": "string",
							"description": "The menu name text"
						},
						"all_items": {
							"type": "string",
							"description": "The 'All Items' text used in the admin menu"
						},
						"add_new": {
							"type": "string",
							"description": "The 'Add New' text"
						},
						"add_new_item": {
							"type": "string",
							"description": "The 'Add New Item' text"
						},
						"edit_item": {
							"type": "string",
							"description": "The 'Edit Item' text"
						},
						"new_item": {
							"type": "string",
							"description": "The 'New Item' text"
						},
						"view_item": {
							"type": "string",
							"description": "The 'View Item' text"
						},
						"view_items": {
							"type": "string",
							"description": "The 'View Items' text"
						},
						"search_items": {
							"type": "string",
							"description": "The 'Search Items' text"
						},
						"not_found": {
							"type": "string",
							"description": "The 'Not Found' text"
						},
						"not_found_in_trash": {
							"type": "string",
							"description": "The 'Not Found in Trash' text"
						},
						"parent_item_colon": {
							"type": "string",
							"description": "The 'Parent Item:' text"
						},
						"archives": {
							"type": "string",
							"description": "The 'Archives' text"
						},
						"attributes": {
							"type": "string",
							"description": "The 'Attributes' text"
						},
						"featured_image": {
							"type": "string",
							"description": "The 'Featured Image' text"
						},
						"set_featured_image": {
							"type": "string",
							"description": "The 'Set Featured Image' text"
						},
						"remove_featured_image": {
							"type": "string",
							"description": "The 'Remove Featured Image' text"
						},
						"use_featured_image": {
							"type": "string",
							"description": "The 'Use as Featured Image' text"
						},
						"insert_into_item": {
							"type": "string",
							"description": "The 'Insert into Item' text"
						},
						"uploaded_to_this_item": {
							"type": "string",
							"description": "The 'Uploaded to this Item' text"
						},
						"filter_items_list": {
							"type": "string",
							"description": "The 'Filter Items List' text"
						},
						"filter_by_date": {
							"type": "string",
							"description": "The 'Filter by Date' text"
						},
						"items_list_navigation": {
							"type": "string",
							"description": "The 'Items List Navigation' text"
						},
						"items_list": {
							"type": "string",
							"description": "The 'Items List' text"
						},
						"item_published": {
							"type": "string",
							"description": "The 'Item Published' text"
						},
						"item_published_privately": {
							"type": "string",
							"description": "The 'Item Published Privately' text"
						},
						"item_reverted_to_draft": {
							"type": "string",
							"description": "The 'Item Reverted to Draft' text"
						},
						"item_scheduled": {
							"type": "string",
							"description": "The 'Item Scheduled' text"
						},
						"item_updated": {
							"type": "string",
							"description": "The 'Item Updated' text"
						},
						"item_link": {
							"type": "string",
							"description": "The 'Item Link' text"
						},
						"item_link_description": {
							"type": "string",
							"description": "The 'Item Link Description' text"
						}
					}
				},
				"description": {
					"type": "string",
					"description": "A short description of what your post type is"
				},

				"public": {
					"type": "boolean",
					"default": true,
					"description": "Whether a post type is intended for use publicly either via the admin interface or by front-end users"
				},
				"hierarchical": {
					"type": "boolean",
					"default": false,
					"description": "Whether the post type is hierarchical (e.g. page)"
				},
				"exclude_from_search": {
					"type": "boolean",
					"default": false,
					"description": "Whether to exclude posts with this post type from front-end search results"
				},
				"publicly_queryable": {
					"type": "boolean",
					"default": true,
					"description": "Whether queries can be performed on the front-end for the post type as part of parse_request()"
				},

				"show_ui": {
					"type": "boolean",
					"default": true,
					"description": "Whether to generate and allow a UI for managing this post type in the admin"
				},
				"show_in_menu": {
					"type": "boolean",
					"description": "Where to show the post type in the admin menu"
				},
				"menu_position": {
					"type": [ "integer", "string", "null" ],
					"description": "The position in the menu order. SCF exports as empty string or null when not set, integer when set. Import accepts all types and casts to integer. If omitted, appears below Comments in admin menu."
				},
				"menu_icon": {
					"oneOf": [
						{
							"type": "string",
							"description": "Icon as string: Dashicon name (e.g. 'dashicons-admin-post') or full URL to image file"
						},
						{
							"type": "object",
							"properties": {
								"type": {
									"type": "string",
									"enum": [ "dashicons", "url" ],
									"description": "Icon source type: 'dashicons' for WordPress dashicons, 'url' for custom image"
								},
								"value": {
									"type": "string",
									"description": "The icon value: dashicon class name (e.g. 'dashicons-admin-post') or image URL"
								}
							},
							"required": [ "type", "value" ],
							"additionalProperties": false,
							"description": "[SCF] SCF icon object format: {\"type\": \"dashicons\", \"value\": \"dashicons-admin-post\"}"
						}
					],
					"description": "The menu icon. Can be a string (URL or dashicon name) or SCF object format with type and value properties. If omitted, uses default posts icon (dashicons-admin-post)."
				},
				"admin_menu_parent": {
					"type": "string",
					"description": "The parent menu slug for this post type menu"
				},
				"show_in_admin_bar": {
					"type": "boolean",
					"default": true,
					"description": "Whether to make this post type available in the WordPress admin bar"
				},
				"show_in_nav_menus": {
					"type": "boolean",
					"default": true,
					"description": "Whether post_type is available for selection in navigation menus"
				},

				"supports": {
					"type": "array",
					"items": { "type": "string" },
					"uniqueItems": true,
					"description": "Core feature(s) the post type supports. Common values: 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'post-formats'. Custom supports are also allowed. If omitted, defaults to ['title', 'editor']."
				},
				"taxonomies": {
					"anyOf": [
						{
							"type": "array",
							"items": { "type": "string" },
							"uniqueItems": true
						},
						{ "type": "string" }
					],
					"description": "An array of taxonomy identifiers that will be registered for the post type. SCF exports as empty string when none selected, but accepts both array and string on import."
				},
				"can_export": {
					"type": "boolean",
					"default": true,
					"description": "Whether to allow this post type to be exported"
				},
				"delete_with_user": {
					"type": [ "boolean", "null" ],
					"description": "Whether to delete posts of this type when deleting a user"
				},

				"has_archive": {
					"type": [ "boolean", "string" ],
					"default": false,
					"description": "Whether there should be post type archives, or if a string, the archive slug to use"
				},
				"has_archive_slug": {
					"type": "string",
					"description": "The slug to use for the archive if has_archive is enabled"
				},
				"rewrite": {
					"type": [ "object", "boolean" ],
					"description": "Triggers the handling of rewrites for this post type",
					"oneOf": [
						{ "type": "boolean" },
						{
							"type": "object",
							"additionalProperties": false,
							"properties": {
								"permalink_rewrite": {
									"type": "string",
									"description": "[SCF] SCF-specific permalink rewrite option"
								},
								"slug": {
									"type": "string",
									"description": "Customize the permalink structure slug"
								},
								"with_front": {
									"type": [ "boolean", "string" ],
									"default": true,
									"description": "Whether the permalink structure should be prepended with WP_Rewrite::$front (accepts boolean or string '0'/'1' for backward compatibility)"
								},
								"feeds": {
									"type": [ "boolean", "string" ],
									"default": false,
									"description": "Whether the feed permalink structure should be built for this post type (accepts boolean or string '0'/'1' for backward compatibility)"
								},
								"pages": {
									"type": [ "boolean", "string" ],
									"default": true,
									"description": "Whether the permalink structure should provide for pagination (accepts boolean or string '0'/'1' for backward compatibility)"
								}
							}
						}
					]
				},
				"query_var": {
					"type": [ "boolean", "string" ],
					"description": "Sets the query_var key for this post type"
				},
				"query_var_name": {
					"type": "string",
					"description": "[SCF] SCF-specific query variable name"
				},

				"capability_type": {
					"type": [ "string", "array" ],
					"description": "The string to use to build the read, edit, and delete capabilities"
				},
				"rename_capabilities": {
					"type": "boolean",
					"default": false,
					"description": "Whether to rename capabilities for this post type"
				},
				"singular_capability_name": {
					"type": "string",
					"default": "post",
					"description": "The singular capability name (e.g. 'post' creates 'edit_post', 'delete_post' capabilities)"
				},
				"plural_capability_name": {
					"type": "string",
					"default": "posts",
					"description": "The plural capability name (e.g. 'posts' creates 'edit_posts', 'delete_posts' capabilities)"
				},
				"capabilities": {
					"type": "object",
					"additionalProperties": { "type": "string" },
					"description": "[SCF Not Yet Supported] Custom capabilities for this post type. This property is preserved in exports but not currently implemented during import. Currently, use the rename_capabilities system instead for custom capability names."
				},
				"map_meta_cap": {
					"type": "boolean",
					"description": "Whether to use the internal default meta capability handling"
				},

				"show_in_rest": {
					"type": "boolean",
					"default": true,
					"description": "Whether to include the post type in the REST API"
				},
				"rest_base": {
					"type": "string",
					"description": "To change the base URL of REST API route"
				},
				"rest_namespace": {
					"type": "string",
					"default": "wp/v2",
					"description": "To change the namespace URL of REST API route"
				},
				"rest_controller_class": {
					"type": "string",
					"default": "WP_REST_Posts_Controller",
					"description": "REST API Controller to use for this post type"
				},

				"register_meta_box_cb": {
					"type": "string",
					"description": "Callback function for custom meta box registration"
				},
				"enter_title_here": {
					"type": "string",
					"description": "Custom placeholder text for the title field"
				}
			}
		}
	},
	"examples": [
		{
			"key": "post_type_6824c6d969942",
			"title": "Books",
			"menu_order": 0,
			"active": true,
			"post_type": "book",
			"advanced_configuration": false,
			"import_source": "",
			"import_date": "",
			"labels": {
				"name": "Books",
				"singular_name": "Book",
				"menu_name": "Book",
				"all_items": "All Book",
				"edit_item": "Edit Book",
				"view_item": "View Book",
				"view_items": "View Book",
				"add_new_item": "Add New Book",
				"add_new": "Add New Book",
				"new_item": "New Book",
				"parent_item_colon": "Parent Book:",
				"search_items": "Search Book",
				"not_found": "No book found",
				"not_found_in_trash": "No book found in Trash",
				"archives": "Book Archives",
				"attributes": "Book Attributes",
				"featured_image": "",
				"set_featured_image": "",
				"remove_featured_image": "",
				"use_featured_image": "",
				"insert_into_item": "Insert into book",
				"uploaded_to_this_item": "Uploaded to this book",
				"filter_items_list": "Filter book list",
				"filter_by_date": "Filter book by date",
				"items_list_navigation": "Book list navigation",
				"items_list": "Book list",
				"item_published": "Book published.",
				"item_published_privately": "Book published privately.",
				"item_reverted_to_draft": "Book reverted to draft.",
				"item_scheduled": "Book scheduled.",
				"item_updated": "Book updated.",
				"item_link": "Book Link",
				"item_link_description": "A link to a book."
			},
			"description": "",
			"public": true,
			"hierarchical": false,
			"exclude_from_search": false,
			"publicly_queryable": true,
			"show_ui": true,
			"show_in_menu": true,
			"admin_menu_parent": "",
			"show_in_admin_bar": true,
			"show_in_nav_menus": true,
			"show_in_rest": true,
			"rest_base": "",
			"rest_namespace": "wp/v2",
			"rest_controller_class": "WP_REST_Posts_Controller",
			"menu_position": "",
			"menu_icon": {
				"type": "dashicons",
				"value": "dashicons-admin-post"
			},
			"rename_capabilities": false,
			"singular_capability_name": "post",
			"plural_capability_name": "posts",
			"supports": [ "title", "editor", "thumbnail", "custom-fields" ],
			"taxonomies": "",
			"has_archive": false,
			"has_archive_slug": "",
			"rewrite": {
				"permalink_rewrite": "post_type_key",
				"with_front": "1",
				"feeds": "0",
				"pages": "1"
			},
			"query_var": "post_type_key",
			"query_var_name": "",
			"can_export": true,
			"delete_with_user": false,
			"register_meta_box_cb": "",
			"enter_title_here": ""
		}
	]
}
