use crate::model;
use crate::models::KnownValues;
pub const USER_ROLES: &[&str] = &[
"owner",
"member",
"admin",
"it-admin",
"network-admin",
"billing-admin",
"auditor",
];
pub const INVITE_ROLES: &[&str] = &[
"member",
"admin",
"it-admin",
"network-admin",
"billing-admin",
"auditor",
];
pub const USER_TYPES: &[&str] = &["member", "shared"];
pub const USER_STATUSES: &[&str] = &[
"active",
"idle",
"suspended",
"needs-approval",
"over-billing-limit",
];
pub const CONTACT_TYPES: &[&str] = &["account", "support", "security"];
pub const USER_ROLE_FILTERS: &[&str] = &[
"owner",
"member",
"admin",
"it-admin",
"network-admin",
"billing-admin",
"auditor",
"all",
];
pub const USER_TYPE_FILTERS: &[&str] = &["member", "shared", "all"];
pub const KNOWN_VALUES: &[KnownValues] = &[
("User.role", USER_ROLES),
("User.type", USER_TYPES),
("User.status", USER_STATUSES),
("UserInvite.role", INVITE_ROLES),
("?contactType", CONTACT_TYPES),
("/tailnet/{tailnet}/users ?role", USER_ROLE_FILTERS),
("/tailnet/{tailnet}/users ?type", USER_TYPE_FILTERS),
("POST /users/{userId}/role body.role", USER_ROLES),
("POST /tailnet/{tailnet}/user-invites body[].role", INVITE_ROLES),
];
model! {
User {
id: "id" => String,
display_name: "displayName" => String,
login_name: "loginName" => String,
profile_pic_url: "profilePicUrl" => String,
tailnet_id: "tailnetId" => String,
created: "created" => String,
user_type: "type" => String,
role: "role" => String,
status: "status" => String,
device_count: "deviceCount" => i64,
last_seen: "lastSeen" => String,
currently_connected: "currentlyConnected" => bool,
}
UserInvite {
id: "id" => String,
role: "role" => String,
tailnet_id: "tailnetId" => i64,
inviter_id: "inviterId" => i64,
email: "email" => String,
last_email_sent_at: "lastEmailSentAt" => String,
invite_url: "inviteUrl" => String,
}
Contact {
email: "email" => String,
fallback_email: "fallbackEmail" => String,
needs_verification: "needsVerification" => bool,
}
UserList as "GET /tailnet/{tailnet}/users 200" {
users: "users" => Vec<User>,
}
UserRole as "POST /users/{userId}/role body" {
role: "role" => String,
}
CreateUserInvite as "POST /tailnet/{tailnet}/user-invites body[]" {
role: "role" => String,
email: "email" => String,
}
Contacts as "GET /tailnet/{tailnet}/contacts 200" {
account: "account" => Contact,
support: "support" => Contact,
security: "security" => Contact,
}
UpdateContact as "PATCH /tailnet/{tailnet}/contacts/{contactType} body" {
email: "email" => String,
}
}