#include <xtd/xtd>
enum class cap {title, middle, end};
auto print_time_span(const string& text, const time_span& value, cap c) {
if (c == cap::title)
console::out
<< "┌──────────────────────────────────────────┬────────────┬──────────────────────────────────────────┐" << environment::new_line
<< "│ time_span │ format │ representation │" << environment::new_line
<< "├──────────────────────────────────────────┼────────────┼──────────────────────────────────────────┤" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {} │ " << string::format("{}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:c} │ " << string::format("{:c}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:d} │ " << string::format("{:d}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:D} │ " << string::format("{:D}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:f} │ " << string::format("{:f}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:F} │ " << string::format("{:F}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:g} │ " << string::format("{:g}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:G} │ " << string::format("{:G}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:h} │ " << string::format("{:h}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:H} │ " << string::format("{:H}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:m} │ " << string::format("{:m}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:M} │ " << string::format("{:M}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:n} │ " << string::format("{:n}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:N} │ " << string::format("{:N}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:s} │ " << string::format("{:s}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:S} │ " << string::format("{:S}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:t} │ " << string::format("{:t}", value).pad_right(40) << " │" << environment::new_line;
console::out << "│ " << text.pad_right(40) << " │ {:T} │ " << string::format("{:T}", value).pad_right(40) << " │" << environment::new_line;
if (c != cap::end)
console::out << "├──────────────────────────────────────────┼────────────┼──────────────────────────────────────────┤" << environment::new_line;
else
console::out << "└──────────────────────────────────────────┴────────────┴──────────────────────────────────────────┘" << environment::new_line;
}
auto main() -> int {
print_time_span("{}", time_span {}, cap::title);
print_time_span("6_h + 3_min + 8_s", 6_h + 3_min + 8_s, cap::middle);
print_time_span("52_h + 3_min + 32_s", 52_h + 3_min + 2_s, cap::middle);
print_time_span("24_ms + 543_ns", 24_ms + 543_ns, cap::middle);
print_time_span("52_h + 3_min + 2_s + 24_ms + 543_ns", 52_h + 3_min + 2_s + 24_ms + 543_ns, cap::middle);
print_time_span("time_span::min_value", time_span::min_value, cap::middle);
print_time_span("time_span::max_value", time_span::max_value, cap::end);
}