//! This code is @generated by `policy-ifgen`. DO NOT EDIT.
#![cfg_attr(rustfmt, rustfmt::skip)]
#![allow(clippy::duplicated_attributes)]
#![allow(clippy::enum_variant_names)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
extern crate alloc;
use alloc::vec::Vec;
use aranya_policy_ifgen::{
    macros::{action, actions, effect, effects, value},
    BaseId, ClientError, Value, Text,
};
#[derive(Debug)]
pub enum Persistent {}
#[derive(Debug)]
pub enum Ephemeral {}
/// KeyBundle policy struct.
#[value]
pub struct KeyBundle {
    pub ident_key: Vec<u8>,
    pub sign_key: Vec<u8>,
    pub enc_key: Vec<u8>,
}
/// ChanOp policy enum.
#[value]
pub enum ChanOp {
    RecvOnly,
    SendOnly,
    SendRecv,
}
/// RoleManagementPerm policy enum.
#[value]
pub enum RoleManagementPerm {
    CanAssignRole,
    CanRevokeRole,
    CanChangeRolePerms,
}
/// SimplePerm policy enum.
#[value]
pub enum SimplePerm {
    AddDevice,
    RemoveDevice,
    TerminateTeam,
    CreateRole,
    DeleteRole,
    AssignRole,
    RevokeRole,
    ChangeRoleManagementPerms,
    SetupDefaultRole,
    ChangeRoleManagingRole,
    CreateLabel,
    DeleteLabel,
    ChangeLabelManagingRole,
    AssignLabel,
    RevokeLabel,
    CanUseAfc,
    CreateAfcUniChannel,
}
/// Enum of policy effects that can occur in response to a policy action.
#[effects]
pub enum Effect {
    AfcUniChannelCreated(AfcUniChannelCreated),
    AfcUniChannelReceived(AfcUniChannelReceived),
    AssignedLabelToDevice(AssignedLabelToDevice),
    CheckValidAfcChannels(CheckValidAfcChannels),
    DeviceAdded(DeviceAdded),
    DeviceRemoved(DeviceRemoved),
    LabelCreated(LabelCreated),
    LabelDeleted(LabelDeleted),
    LabelManagingRoleAdded(LabelManagingRoleAdded),
    LabelManagingRoleRevoked(LabelManagingRoleRevoked),
    LabelRevokedFromDevice(LabelRevokedFromDevice),
    PermAddedToRole(PermAddedToRole),
    PermRemovedFromRole(PermRemovedFromRole),
    QueryAfcChannelIsValidResult(QueryAfcChannelIsValidResult),
    QueryDeviceKeyBundleResult(QueryDeviceKeyBundleResult),
    QueryDeviceRoleResult(QueryDeviceRoleResult),
    QueryDevicesOnTeamResult(QueryDevicesOnTeamResult),
    QueryLabelResult(QueryLabelResult),
    QueryLabelsAssignedToDeviceResult(QueryLabelsAssignedToDeviceResult),
    QueryLabelsResult(QueryLabelsResult),
    QueryRoleOwnersResult(QueryRoleOwnersResult),
    QueryTeamRolesResult(QueryTeamRolesResult),
    RoleAssigned(RoleAssigned),
    RoleChanged(RoleChanged),
    RoleCreated(RoleCreated),
    RoleDeleted(RoleDeleted),
    RoleManagementPermAssigned(RoleManagementPermAssigned),
    RoleManagementPermRevoked(RoleManagementPermRevoked),
    RoleOwnerAdded(RoleOwnerAdded),
    RoleOwnerRemoved(RoleOwnerRemoved),
    RoleRevoked(RoleRevoked),
    TeamCreated(TeamCreated),
    TeamTerminated(TeamTerminated),
}
/// AfcUniChannelCreated policy effect.
#[effect]
pub struct AfcUniChannelCreated {
    pub parent_cmd_id: BaseId,
    pub receiver_id: BaseId,
    pub author_enc_key_id: BaseId,
    pub peer_enc_pk: Vec<u8>,
    pub label_id: BaseId,
    pub channel_key_id: BaseId,
    pub encap: Vec<u8>,
}
/// AfcUniChannelReceived policy effect.
#[effect]
pub struct AfcUniChannelReceived {
    pub parent_cmd_id: BaseId,
    pub sender_id: BaseId,
    pub author_enc_pk: Vec<u8>,
    pub peer_enc_key_id: BaseId,
    pub label_id: BaseId,
    pub encap: Vec<u8>,
}
/// AssignedLabelToDevice policy effect.
#[effect]
pub struct AssignedLabelToDevice {
    pub device: BaseId,
    pub label_id: BaseId,
    pub author_id: BaseId,
}
/// CheckValidAfcChannels policy effect.
#[effect]
pub struct CheckValidAfcChannels {}
/// DeviceAdded policy effect.
#[effect]
pub struct DeviceAdded {
    pub device_id: BaseId,
    pub device_keys: KeyBundle,
}
/// DeviceRemoved policy effect.
#[effect]
pub struct DeviceRemoved {
    pub device_id: BaseId,
    pub author_id: BaseId,
}
/// LabelCreated policy effect.
#[effect]
pub struct LabelCreated {
    pub label_id: BaseId,
    pub label_name: Text,
    pub label_author_id: BaseId,
    pub managing_role_id: BaseId,
}
/// LabelDeleted policy effect.
#[effect]
pub struct LabelDeleted {
    pub label_name: Text,
    pub label_author_id: BaseId,
    pub label_id: BaseId,
    pub author_id: BaseId,
}
/// LabelManagingRoleAdded policy effect.
#[effect]
pub struct LabelManagingRoleAdded {
    pub label_id: BaseId,
    pub managing_role_id: BaseId,
    pub author_id: BaseId,
}
/// LabelManagingRoleRevoked policy effect.
#[effect]
pub struct LabelManagingRoleRevoked {
    pub label_id: BaseId,
    pub managing_role_id: BaseId,
    pub author_id: BaseId,
}
/// LabelRevokedFromDevice policy effect.
#[effect]
pub struct LabelRevokedFromDevice {
    pub device_id: BaseId,
    pub label_id: BaseId,
    pub label_name: Text,
    pub label_author_id: BaseId,
    pub author_id: BaseId,
}
/// PermAddedToRole policy effect.
#[effect]
pub struct PermAddedToRole {
    pub role_id: BaseId,
    pub perm: SimplePerm,
    pub author_id: BaseId,
}
/// PermRemovedFromRole policy effect.
#[effect]
pub struct PermRemovedFromRole {
    pub role_id: BaseId,
    pub perm: SimplePerm,
    pub author_id: BaseId,
}
/// QueryAfcChannelIsValidResult policy effect.
#[effect]
pub struct QueryAfcChannelIsValidResult {
    pub sender_id: BaseId,
    pub receiver_id: BaseId,
    pub label_id: BaseId,
    pub is_valid: bool,
}
/// QueryDeviceKeyBundleResult policy effect.
#[effect]
pub struct QueryDeviceKeyBundleResult {
    pub device_keys: KeyBundle,
}
/// QueryDeviceRoleResult policy effect.
#[effect]
pub struct QueryDeviceRoleResult {
    pub role_id: BaseId,
    pub name: Text,
    pub author_id: BaseId,
    pub default: bool,
}
/// QueryDevicesOnTeamResult policy effect.
#[effect]
pub struct QueryDevicesOnTeamResult {
    pub device_id: BaseId,
}
/// QueryLabelResult policy effect.
#[effect]
pub struct QueryLabelResult {
    pub label_id: BaseId,
    pub label_name: Text,
    pub label_author_id: BaseId,
}
/// QueryLabelsAssignedToDeviceResult policy effect.
#[effect]
pub struct QueryLabelsAssignedToDeviceResult {
    pub device_id: BaseId,
    pub label_id: BaseId,
    pub label_name: Text,
    pub label_author_id: BaseId,
}
/// QueryLabelsResult policy effect.
#[effect]
pub struct QueryLabelsResult {
    pub label_id: BaseId,
    pub label_name: Text,
    pub label_author_id: BaseId,
}
/// QueryRoleOwnersResult policy effect.
#[effect]
pub struct QueryRoleOwnersResult {
    pub role_id: BaseId,
    pub name: Text,
    pub author_id: BaseId,
    pub default: bool,
}
/// QueryTeamRolesResult policy effect.
#[effect]
pub struct QueryTeamRolesResult {
    pub role_id: BaseId,
    pub name: Text,
    pub author_id: BaseId,
    pub default: bool,
}
/// RoleAssigned policy effect.
#[effect]
pub struct RoleAssigned {
    pub device_id: BaseId,
    pub role_id: BaseId,
    pub author_id: BaseId,
}
/// RoleChanged policy effect.
#[effect]
pub struct RoleChanged {
    pub device_id: BaseId,
    pub old_role_id: BaseId,
    pub new_role_id: BaseId,
    pub author_id: BaseId,
}
/// RoleCreated policy effect.
#[effect]
pub struct RoleCreated {
    pub role_id: BaseId,
    pub name: Text,
    pub author_id: BaseId,
    pub owning_role_id: BaseId,
    pub default: bool,
}
/// RoleDeleted policy effect.
#[effect]
pub struct RoleDeleted {
    pub name: Text,
    pub role_id: BaseId,
}
/// RoleManagementPermAssigned policy effect.
#[effect]
pub struct RoleManagementPermAssigned {
    pub target_role_id: BaseId,
    pub managing_role_id: BaseId,
    pub perm: RoleManagementPerm,
    pub author_id: BaseId,
}
/// RoleManagementPermRevoked policy effect.
#[effect]
pub struct RoleManagementPermRevoked {
    pub target_role_id: BaseId,
    pub managing_role_id: BaseId,
    pub perm: RoleManagementPerm,
    pub author_id: BaseId,
}
/// RoleOwnerAdded policy effect.
#[effect]
pub struct RoleOwnerAdded {
    pub target_role_id: BaseId,
    pub new_role_owner: BaseId,
    pub author_id: BaseId,
}
/// RoleOwnerRemoved policy effect.
#[effect]
pub struct RoleOwnerRemoved {
    pub target_role_id: BaseId,
    pub owning_role_id: BaseId,
    pub author_id: BaseId,
}
/// RoleRevoked policy effect.
#[effect]
pub struct RoleRevoked {
    pub device_id: BaseId,
    pub role_id: BaseId,
    pub author_id: BaseId,
}
/// TeamCreated policy effect.
#[effect]
pub struct TeamCreated {
    pub team_id: BaseId,
    pub owner_id: BaseId,
}
/// TeamTerminated policy effect.
#[effect]
pub struct TeamTerminated {
    pub team_id: BaseId,
    pub owner_id: BaseId,
}
#[actions(interface = Persistent)]
pub enum PersistentAction {
    add_perm_to_role(add_perm_to_role),
    remove_perm_from_role(remove_perm_from_role),
    add_role_owner(add_role_owner),
    remove_role_owner(remove_role_owner),
    assign_role_management_perm(assign_role_management_perm),
    revoke_role_management_perm(revoke_role_management_perm),
    create_role(create_role),
    setup_default_roles(setup_default_roles),
    delete_role(delete_role),
    assign_role(assign_role),
    change_role(change_role),
    revoke_role(revoke_role),
    create_team(create_team),
    terminate_team(terminate_team),
    add_device(add_device),
    remove_device(remove_device),
    add_label_managing_role(add_label_managing_role),
    revoke_label_managing_role(revoke_label_managing_role),
    create_label(create_label),
    delete_label(delete_label),
    assign_label_to_device(assign_label_to_device),
    revoke_label_from_device(revoke_label_from_device),
}
#[actions(interface = Ephemeral)]
pub enum EphemeralAction {
    query_devices_on_team(query_devices_on_team),
    query_afc_channel_is_valid(query_afc_channel_is_valid),
    query_device_role(query_device_role),
    query_device_keybundle(query_device_keybundle),
    query_team_roles(query_team_roles),
    query_role_owners(query_role_owners),
    query_label(query_label),
    query_labels(query_labels),
    query_labels_assigned_to_device(query_labels_assigned_to_device),
    create_afc_uni_channel(create_afc_uni_channel),
}
/// query_devices_on_team policy action.
#[action(interface = Ephemeral)]
pub struct query_devices_on_team {}
/// query_afc_channel_is_valid policy action.
#[action(interface = Ephemeral)]
pub struct query_afc_channel_is_valid {
    pub sender_id: BaseId,
    pub receiver_id: BaseId,
    pub label_id: BaseId,
}
/// query_device_role policy action.
#[action(interface = Ephemeral)]
pub struct query_device_role {
    pub device_id: BaseId,
}
/// query_device_keybundle policy action.
#[action(interface = Ephemeral)]
pub struct query_device_keybundle {
    pub device_id: BaseId,
}
/// add_perm_to_role policy action.
#[action(interface = Persistent)]
pub struct add_perm_to_role {
    pub role_id: BaseId,
    pub perm: SimplePerm,
}
/// remove_perm_from_role policy action.
#[action(interface = Persistent)]
pub struct remove_perm_from_role {
    pub role_id: BaseId,
    pub perm: SimplePerm,
}
/// add_role_owner policy action.
#[action(interface = Persistent)]
pub struct add_role_owner {
    pub target_role_id: BaseId,
    pub new_owning_role: BaseId,
}
/// remove_role_owner policy action.
#[action(interface = Persistent)]
pub struct remove_role_owner {
    pub target_role_id: BaseId,
    pub owning_role_id: BaseId,
}
/// assign_role_management_perm policy action.
#[action(interface = Persistent)]
pub struct assign_role_management_perm {
    pub target_role_id: BaseId,
    pub managing_role_id: BaseId,
    pub perm: RoleManagementPerm,
}
/// revoke_role_management_perm policy action.
#[action(interface = Persistent)]
pub struct revoke_role_management_perm {
    pub target_role_id: BaseId,
    pub managing_role_id: BaseId,
    pub perm: RoleManagementPerm,
}
/// create_role policy action.
#[action(interface = Persistent)]
pub struct create_role {
    pub role_name: Text,
    pub owning_role_id: BaseId,
}
/// setup_default_roles policy action.
#[action(interface = Persistent)]
pub struct setup_default_roles {
    pub owning_role_id: BaseId,
}
/// delete_role policy action.
#[action(interface = Persistent)]
pub struct delete_role {
    pub role_id: BaseId,
}
/// assign_role policy action.
#[action(interface = Persistent)]
pub struct assign_role {
    pub device_id: BaseId,
    pub role_id: BaseId,
}
/// change_role policy action.
#[action(interface = Persistent)]
pub struct change_role {
    pub device_id: BaseId,
    pub old_role_id: BaseId,
    pub new_role_id: BaseId,
}
/// revoke_role policy action.
#[action(interface = Persistent)]
pub struct revoke_role {
    pub device_id: BaseId,
    pub role_id: BaseId,
}
/// query_team_roles policy action.
#[action(interface = Ephemeral)]
pub struct query_team_roles {}
/// query_role_owners policy action.
#[action(interface = Ephemeral)]
pub struct query_role_owners {
    pub role_id: BaseId,
}
/// create_team policy action.
#[action(interface = Persistent)]
pub struct create_team {
    pub owner_keys: KeyBundle,
    pub nonce: Vec<u8>,
}
/// terminate_team policy action.
#[action(interface = Persistent)]
pub struct terminate_team {
    pub team_id: BaseId,
}
/// add_device policy action.
#[action(interface = Persistent)]
pub struct add_device {
    pub device_keys: KeyBundle,
    pub initial_role_id: Option<BaseId>,
}
/// remove_device policy action.
#[action(interface = Persistent)]
pub struct remove_device {
    pub device_id: BaseId,
}
/// add_label_managing_role policy action.
#[action(interface = Persistent)]
pub struct add_label_managing_role {
    pub label_id: BaseId,
    pub managing_role_id: BaseId,
}
/// revoke_label_managing_role policy action.
#[action(interface = Persistent)]
pub struct revoke_label_managing_role {
    pub label_id: BaseId,
    pub managing_role_id: BaseId,
}
/// create_label policy action.
#[action(interface = Persistent)]
pub struct create_label {
    pub name: Text,
    pub managing_role_id: BaseId,
}
/// delete_label policy action.
#[action(interface = Persistent)]
pub struct delete_label {
    pub label_id: BaseId,
}
/// assign_label_to_device policy action.
#[action(interface = Persistent)]
pub struct assign_label_to_device {
    pub device_id: BaseId,
    pub label_id: BaseId,
    pub op: ChanOp,
}
/// revoke_label_from_device policy action.
#[action(interface = Persistent)]
pub struct revoke_label_from_device {
    pub device_id: BaseId,
    pub label_id: BaseId,
}
/// query_label policy action.
#[action(interface = Ephemeral)]
pub struct query_label {
    pub label_id: BaseId,
}
/// query_labels policy action.
#[action(interface = Ephemeral)]
pub struct query_labels {}
/// query_labels_assigned_to_device policy action.
#[action(interface = Ephemeral)]
pub struct query_labels_assigned_to_device {
    pub device_id: BaseId,
}
/// create_afc_uni_channel policy action.
#[action(interface = Ephemeral)]
pub struct create_afc_uni_channel {
    pub receiver_id: BaseId,
    pub label_id: BaseId,
}
