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( 'sales' => 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; } $sales = Ticket_Repository::sales_summary( $post_id ); return array( 'sales' => $sales, 'message' => sprintf( /* translators: 1: tickets sold, 2: estimated revenue */ __( '%1$d sold, estimated revenue %2$s.', 'acrossai-abilities-manager' ), $sales['tickets_sold'], (string) $sales['estimated_revenue'] ), ); } }