<?php 

if ( ! defined( 'ABSPATH' ) ) exit; 

$custom_post_meta_groups = array();
$custom_post_meta_groups['basic']               = array( 'group_name' => 'Product Info',                          				'metabox_classes' => 'metabox100' );
$custom_post_meta_groups['update']              = array( 'group_name' => 'Update Info',                          				'metabox_classes' => 'metabox100' );
$custom_post_meta_groups['links']               = array( 'group_name' => 'URLs',                              					'metabox_classes' => 'metabox100' );
$custom_post_meta_groups['price']               = array( 'group_name' => 'Prices, Offers & Availability',               		'metabox_classes' => 'metabox100' );
$custom_post_meta_groups['texts']               = array( 'group_name' => 'Descriptions and customizable details',    			'metabox_classes' => 'metabox100' );
$custom_post_meta_groups['api']                 = array( 'group_name' => 'API Response',                                		'metabox_classes' => 'metabox100 displayJSON' );
$custom_post_meta_groups['review']              = array( 'group_name' => 'Reviews',                                     		'metabox_classes' => 'metabox100' );
$custom_post_meta_groups['prosncons']           = array( 'group_name' => 'Pros & Cons',                                 		'metabox_classes' => 'metabox100' );
$custom_post_meta_groups['amazingaffiliates']   = array( 'group_name' => 'AmazingAffiliates Inventory',                 		'metabox_classes' => 'metabox100' );


$custom_post_meta = array();
$custom_post_meta['amazing_product']['basic'] = array(
	array( 'type' => 'string',  'slug' => 'id', 				'name' => 'ID', 					    'metabox' => 'displayid',		'metabox_classes' => 'metabox50 gray_metabox' 		),
    array( 'type' => 'string',  'slug' => 'asin', 				'name' => 'ASIN', 					    'metabox' => 'displayasin',		'metabox_classes' => 'metabox50 gray_metabox' 		),
    array( 'type' => 'string',  'slug' => 'creation_date', 		'name' => 'Created On', 			    'metabox' => 'time',			'metabox_classes' => 'metabox50 gray_metabox' 		),
    array( 'type' => 'string',  'slug' => 'last_update', 		'name' => 'Last Updated On', 	    	'metabox' => 'time',			'metabox_classes' => 'metabox50 gray_metabox' 		)
);
$custom_post_meta['amazing_product']['update'] = array(
    array( 'type' => 'string',  'slug' => 'last_update_attempt','name' => 'Last Update Attempt', 		'metabox' => 'time',		'metabox_classes' => 'metabox50 gray_metabox' 		),		
    array( 'type' => 'string',  'slug' => 'has_issues',		 	'name' => 'Issues Code', 				'metabox' => 'display',		'metabox_classes' => 'metabox50 gray_metabox' 		),		
    array( 'type' => 'string',  'slug' => 'last_update_status',	'name' => 'Last Update Status', 		'metabox' => 'display',		'metabox_classes' => 'metabox50 gray_metabox' 		),		
    array( 'type' => 'string',  'slug' => 'has_issues_ext',		'name' => 'Issues Explanation', 		'metabox' => 'display',		'metabox_classes' => 'metabox50 gray_metabox' 		),		
    array( 'type' => 'string',  'slug' => 'not_updateable',		'name' => 'Probably discontinued?', 	'metabox' => 'displaybool',	'metabox_classes' => 'metabox50 gray_metabox' 		)
);
$custom_post_meta['amazing_product']['links'] = array(
    array( 'type' => 'string',  'slug' => 'affiliate_link', 	'name' => 'Amazon Affiliate Link', 		'metabox' => 'inputlink',	    'metabox_classes' => 'metabox100 gold_metabox' 		),
    array( 'type' => 'string',  'slug' => 'primary_img_url', 	'name' => 'Marketplace Image URL',	    'metabox' => 'displaylink',		'metabox_classes' => 'metabox100 gray_metabox'  	)
);
$custom_post_meta['amazing_product']['texts'] = array(
    array( 'type' => 'string',  'slug' => 'custom_title', 		'name' => 'Custom Title', 			    'metabox' => 'textarea',	'metabox_classes' => 'metabox100 green_metabox' 	),
    array( 'type' => 'string',  'slug' => 'details', 			'name' => 'Details (from API\'s)', 		'metabox' => 'editor',		'metabox_classes' => 'metabox100 gold_metabox'  	)
);
$custom_post_meta['amazing_product']['price'] = array(
    array( 'type' => 'string',  'slug' => 'current_price', 		'name' => 'Current Price', 			    'metabox' => 'input',		'metabox_classes' => 'metabox50 gold_metabox' 		),
    array( 'type' => 'string',  'slug' => 'currency', 			'name' => 'Currency', 				    'metabox' => 'input',	    'metabox_classes' => 'metabox25 gold_metabox'  		),
    array( 'type' => 'string',  'slug' => 'list_price', 		'name' => 'List Price', 			    'metabox' => 'input',		'metabox_classes' => 'metabox50 gold_metabox' 		),
    array( 'type' => 'number',  'slug' => 'offer', 				'name' => 'Offer', 					    'metabox' => 'inputbool',	'metabox_classes' => 'metabox25 gold_metabox'  		),
    array( 'type' => 'number',  'slug' => 'discount', 			'name' => 'Discount', 				    'metabox' => 'inputx100',	'metabox_classes' => 'metabox33 gold_metabox'  		),
    array( 'type' => 'boolean', 'slug' => 'stock', 				'name' => 'Stock Status', 			    'metabox' => 'inputbool',	'metabox_classes' => 'metabox33 gray_metabox'  		),
    array( 'type' => 'string',  'slug' => 'availability', 		'name' => 'Availability Status', 	    'metabox' => 'input',		'metabox_classes' => 'metabox33 gray_metabox'  		),
    array( 'type' => 'string',  'slug' => 'availability_msg', 	'name' => 'Availability Message', 	    'metabox' => 'input',		'metabox_classes' => 'metabox33 gray_metabox'  		),
    array( 'type' => 'string',  'slug' => 'condition-value', 	'name' => 'Condition Value', 		    'metabox' => 'input',		'metabox_classes' => 'metabox33 gray_metabox'  		),
    array( 'type' => 'string',  'slug' => 'merchant_info-name', 'name' => 'Merchant Name', 			    'metabox' => 'input',		'metabox_classes' => 'metabox33 gray_metabox'  		)
);
$custom_post_meta['amazing_product']['api'] = array(
    array( 'type' => 'string',  'slug' => 'api_response', 		'name' => 'Last Cached JSON:', 			'metabox' => 'displayjson',	    'metabox_classes' => 'metabox100 gray_metabox'  	)
);

$custom_post_meta['post']['amazingaffiliates'] = array(
    array( 'type' => 'string',  'slug' => 'products', 			'name' => 'Products', 				    'metabox' => 'display',	    'metabox_classes' => 'metabox100 gray_metabox' 		)
);


$custom_post_meta_metaboxes = array();
$custom_post_meta_metaboxes[0] = array( 'id' => 'amazing_product_meta_metabox',     'title' => 'Product Data at Sitewide Level',   'post_type' => 'amazing_product' );
$custom_post_meta_metaboxes[1] = array( 'id' => 'amazing_post_meta_metabox',        'title' => 'AmazingAffiliates Data',   	'post_type' => 'post' );