array( 'type' => 'integer', 'minimum' => 1, 'description' => __( 'The event, page or other ticketed post.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'post_id' ); } protected function output_properties(): array { return array( 'capacity' => array( 'type' => 'object' ), ); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } protected function run( array $input ) { $post_id = (int) $input['post_id']; $post = Ticket_Repository::require_ticketable( $post_id ); if ( is_wp_error( $post ) ) { return $post; } $report = Ticket_Repository::capacity_report( $post_id ); return array( 'capacity' => $report, 'message' => sprintf( /* translators: 1: number of tickets, 2: sold count */ __( '%1$d ticket type(s), %2$d sold.', 'acrossai-abilities-manager' ), count( $report['tickets'] ), $report['total_sold'] ), ); } }