array( 'type' => 'integer', 'minimum' => 1, 'description' => __( 'The ticket ID.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'ticket_id' ); } protected function output_properties(): array { return array( 'ticket' => array( 'type' => 'object' ), ); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } protected function run( array $input ) { $ticket_id = (int) $input['ticket_id']; $ticket = Ticket_Repository::require_ticket( $ticket_id ); if ( is_wp_error( $ticket ) ) { return $ticket; } $row = Ticket_Repository::describe_ticket( $ticket ); return array( 'ticket' => $row, 'message' => sprintf( /* translators: 1: ticket name, 2: available count */ __( '"%1$s" — %2$s.', 'acrossai-abilities-manager' ), $row['name'], $row['unlimited'] ? __( 'unlimited', 'acrossai-abilities-manager' ) : sprintf( /* translators: %d: count */ __( '%d available', 'acrossai-abilities-manager' ), $row['available'] ) ), ); } }