use colored::Colorize;
use solana_client::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;
use tabled::{Alignment, Modify, Panel, Rotate, Style, Table};
use tabled::object::Segment;
use tabled::style::Color;
use common::command::{CliConfig, ProcessResult};
use common::contract::state::farming::mine::Quarry;
use common::program::MINE_PROGRAM_ID;
pub fn process_farming_quarry_mine_info(
rpc_client: &RpcClient,
_: &CliConfig,
rewarder: Pubkey,
mint: Pubkey,
) -> ProcessResult {
let quarry = Pubkey::find_program_address(
&[
b"Quarry",
rewarder.as_ref(),
mint.as_ref(),
],
&MINE_PROGRAM_ID,
);
let info = Quarry::get_info(rpc_client, &quarry.0);
let color = Color::try_from(" ".cyan().to_string()).unwrap();
Ok(Table::new(vec![info])
.with(Rotate::Bottom)
.with(Rotate::Right)
.with(Style::modern())
.with(color)
.with(Panel("Minter Info", 0))
.with(Modify::new(Segment::all()).with(Alignment::center()))
.to_string())
}