<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

function chcpl_register_post_types() {
	$common_labels_list = array(
		'name'               => __( 'Price Lists', 'ad-pro-price-list' ),
		'singular_name'      => __( 'Price List', 'ad-pro-price-list' ),
		'add_new'            => __( 'Add New', 'ad-pro-price-list' ),
		'add_new_item'       => __( 'Add New Price List', 'ad-pro-price-list' ),
		'edit_item'          => __( 'Edit Price List', 'ad-pro-price-list' ),
		'new_item'           => __( 'New Price List', 'ad-pro-price-list' ),
		'all_items'          => __( 'All Price Lists', 'ad-pro-price-list' ),
		'view_item'          => __( 'View Price List', 'ad-pro-price-list' ),
		'not_found'          => __( 'No price lists found', 'ad-pro-price-list' ),
		'not_found_in_trash' => __( 'No price lists found in Trash', 'ad-pro-price-list' ),
	);

	register_post_type( 'price_list', array(
		'labels' => $common_labels_list,
		'public' => true,
		'show_ui' => true,
		'show_in_menu' => true,
		'menu_icon' => 'dashicons-list-view',
		'supports' => array( 'title' ),
		'has_archive' => false,
		'exclude_from_search' => true,
		'publicly_queryable' => false,
		'show_in_rest' => false,
		'rewrite' => false,
	) );

	$service_labels = array(
		'name'               => __( 'Services', 'ad-pro-price-list' ),
		'singular_name'      => __( 'Service', 'ad-pro-price-list' ),
		'add_new'            => __( 'Add New Service', 'ad-pro-price-list' ),
		'add_new_item'       => __( 'Add New Service', 'ad-pro-price-list' ),
		'edit_item'          => __( 'Edit Service', 'ad-pro-price-list' ),
		'new_item'           => __( 'New Service', 'ad-pro-price-list' ),
		'all_items'          => __( 'All Services', 'ad-pro-price-list' ),
		'view_item'          => __( 'View Service', 'ad-pro-price-list' ),
		'not_found'          => __( 'No services found', 'ad-pro-price-list' ),
		'not_found_in_trash' => __( 'No services found in Trash', 'ad-pro-price-list' ),
	);

	register_post_type( 'price_service', array(
		'labels' => $service_labels,
		'public' => false,
		'show_ui' => true,
		'show_in_menu' => 'edit.php?post_type=price_list',
		'supports' => array( 'title', 'page-attributes' ),
		'has_archive' => false,
		'exclude_from_search' => true,
		'publicly_queryable' => false,
		'show_in_rest' => false,
		'rewrite' => false,
	) );

	$cat_labels = array(
		'name'              => __( 'Service Categories', 'ad-pro-price-list' ),
		'singular_name'     => __( 'Service Category', 'ad-pro-price-list' ),
		'search_items'      => __( 'Search Categories', 'ad-pro-price-list' ),
		'all_items'         => __( 'All Categories', 'ad-pro-price-list' ),
		'parent_item'       => __( 'Parent Category', 'ad-pro-price-list' ),
		'parent_item_colon' => __( 'Parent Category:', 'ad-pro-price-list' ),
		'edit_item'         => __( 'Edit Category', 'ad-pro-price-list' ),
		'update_item'       => __( 'Update Category', 'ad-pro-price-list' ),
		'add_new_item'      => __( 'Add New Category', 'ad-pro-price-list' ),
		'new_item_name'     => __( 'New Category Name', 'ad-pro-price-list' ),
		'menu_name'         => __( 'Categories', 'ad-pro-price-list' ),
	);

	register_taxonomy( 'price_category', array( 'price_service' ), array(
		'hierarchical' => true,
		'labels' => $cat_labels,
		'show_ui' => true,
		'show_admin_column' => true,
		'query_var' => false,
		'show_in_rest' => false,
		'rewrite' => false,
	) );
}
