use serde::Serialize;
use crate::caller::Relation;
use crate::schema::ChannelWaitOutcomeSchema;
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct SessionView {
pub id: String,
pub name: String,
pub windows: u32,
pub attached: bool,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct WindowView {
pub id: String,
pub session_id: String,
pub index: i32,
pub name: String,
pub panes: u32,
pub active: bool,
pub linked: bool,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct PaneView {
pub id: String,
pub window_id: String,
pub command: Option<String>,
pub path: Option<String>,
pub active: bool,
pub caller: Relation,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Sessions {
pub sessions: Vec<SessionView>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Windows {
pub windows: Vec<WindowView>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Panes {
pub panes: Vec<PaneView>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct BranchPane {
pub id: String,
pub command: Option<String>,
pub active: bool,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct BranchWindow {
pub id: String,
pub index: i32,
pub name: String,
pub active: bool,
pub linked: bool,
pub panes: Vec<BranchPane>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Branch {
pub id: String,
pub name: String,
pub attached: bool,
pub windows: Vec<BranchWindow>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Tree {
pub sessions: Vec<Branch>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Marks {
Present,
Absent,
Unsupported,
NotAsked,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Capture {
pub pane: String,
pub text: String,
pub lines: usize,
pub marks: Marks,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Snapshot {
pub pane: PaneView,
pub width: u32,
pub height: u32,
pub cursor_x: Option<u32>,
pub cursor_y: Option<u32>,
pub in_mode: bool,
pub mode: Option<String>,
pub scroll_position: Option<i32>,
pub dead: bool,
pub content: String,
pub lines: usize,
pub dropped: usize,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct MatchView {
pub pane: String,
pub window_id: String,
pub line: usize,
pub text: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Matches {
pub matches: Vec<MatchView>,
pub panes_searched: usize,
pub capped: bool,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Since {
pub pane: String,
pub text: String,
pub cursor: String,
pub missed: bool,
pub closed: bool,
pub first: bool,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct OptionValue {
pub name: String,
pub value: Option<String>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct ChannelWait {
pub channel: String,
#[schemars(with = "ChannelWaitOutcomeSchema")]
pub outcome: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct ChannelSignal {
pub channel: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Sent {
pub pane: String,
pub panes: Vec<String>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Size {
pub pane: String,
pub width: u32,
pub height: u32,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Killed {
pub id: String,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, schemars::JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum EnvironmentState {
Set,
Removed,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct EnvironmentEntry {
pub name: String,
pub state: EnvironmentState,
pub value: Option<String>,
pub withheld: bool,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Environment {
pub entries: Vec<EnvironmentEntry>,
pub session: Option<String>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Hook {
pub name: String,
pub index: Option<u32>,
pub command: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Hooks {
pub hooks: Vec<Hook>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Layout {
pub window: String,
pub layout: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct PaneChanged {
pub pane: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct Pasted {
pub pane: String,
pub bytes: usize,
}