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( 'tickets' => array( 'type' => 'array' ), 'count' => array( 'type' => 'integer' ), ); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } protected function suggested_abilities(): array { return array( array( 'slug' => 'tickets/get-capacity-report', 'reason' => __( 'The event-level shared pool, which a ticket in global or capped mode draws from.', 'acrossai-abilities-manager' ), ), array( 'slug' => 'tickets/get-attendee-summary', 'reason' => __( 'How many people are actually coming.', 'acrossai-abilities-manager' ), ), ); } 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; } $rows = Ticket_Repository::tickets_for( $post_id ); return array( 'tickets' => $rows, 'count' => count( $rows ), 'message' => sprintf( /* translators: 1: number of tickets, 2: post ID */ _n( '%1$d ticket on post %2$d.', '%1$d tickets on post %2$d.', count( $rows ), 'acrossai-abilities-manager' ), count( $rows ), $post_id ), ); } }