/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.6
 * Contact: contact@orvanta.cloud
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuditLog {
    #[serde(rename = "workspace_id")]
    pub workspace_id: String,
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "timestamp")]
    pub timestamp: String,
    #[serde(rename = "username")]
    pub username: String,
    #[serde(rename = "operation")]
    pub operation: Operation,
    #[serde(rename = "action_kind")]
    pub action_kind: ActionKind,
    #[serde(rename = "resource", skip_serializing_if = "Option::is_none")]
    pub resource: Option<String>,
    #[serde(rename = "parameters", skip_serializing_if = "Option::is_none")]
    pub parameters: Option<serde_json::Value>,
    #[serde(rename = "span", skip_serializing_if = "Option::is_none")]
    pub span: Option<String>,
}

impl AuditLog {
    pub fn new(workspace_id: String, id: i32, timestamp: String, username: String, operation: Operation, action_kind: ActionKind) -> AuditLog {
        AuditLog {
            workspace_id,
            id,
            timestamp,
            username,
            operation,
            action_kind,
            resource: None,
            parameters: None,
            span: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Operation {
    #[serde(rename = "jobs.run")]
    JobsPeriodRun,
    #[serde(rename = "jobs.run.script")]
    JobsPeriodRunPeriodScript,
    #[serde(rename = "jobs.run.preview")]
    JobsPeriodRunPeriodPreview,
    #[serde(rename = "jobs.run.flow")]
    JobsPeriodRunPeriodFlow,
    #[serde(rename = "jobs.run.flow_preview")]
    JobsPeriodRunPeriodFlowPreview,
    #[serde(rename = "jobs.run.script_hub")]
    JobsPeriodRunPeriodScriptHub,
    #[serde(rename = "jobs.run.dependencies")]
    JobsPeriodRunPeriodDependencies,
    #[serde(rename = "jobs.run.identity")]
    JobsPeriodRunPeriodIdentity,
    #[serde(rename = "jobs.run.noop")]
    JobsPeriodRunPeriodNoop,
    #[serde(rename = "jobs.flow_dependencies")]
    JobsPeriodFlowDependencies,
    #[serde(rename = "jobs")]
    Jobs,
    #[serde(rename = "jobs.cancel")]
    JobsPeriodCancel,
    #[serde(rename = "jobs.force_cancel")]
    JobsPeriodForceCancel,
    #[serde(rename = "jobs.disapproval")]
    JobsPeriodDisapproval,
    #[serde(rename = "jobs.delete")]
    JobsPeriodDelete,
    #[serde(rename = "account.delete")]
    AccountPeriodDelete,
    #[serde(rename = "ai.request")]
    AiPeriodRequest,
    #[serde(rename = "resources.create")]
    ResourcesPeriodCreate,
    #[serde(rename = "resources.update")]
    ResourcesPeriodUpdate,
    #[serde(rename = "resources.delete")]
    ResourcesPeriodDelete,
    #[serde(rename = "resource_types.create")]
    ResourceTypesPeriodCreate,
    #[serde(rename = "resource_types.update")]
    ResourceTypesPeriodUpdate,
    #[serde(rename = "resource_types.delete")]
    ResourceTypesPeriodDelete,
    #[serde(rename = "schedule.create")]
    SchedulePeriodCreate,
    #[serde(rename = "schedule.setenabled")]
    SchedulePeriodSetenabled,
    #[serde(rename = "schedule.edit")]
    SchedulePeriodEdit,
    #[serde(rename = "schedule.delete")]
    SchedulePeriodDelete,
    #[serde(rename = "scripts.create")]
    ScriptsPeriodCreate,
    #[serde(rename = "scripts.update")]
    ScriptsPeriodUpdate,
    #[serde(rename = "scripts.archive")]
    ScriptsPeriodArchive,
    #[serde(rename = "scripts.delete")]
    ScriptsPeriodDelete,
    #[serde(rename = "users.create")]
    UsersPeriodCreate,
    #[serde(rename = "users.delete")]
    UsersPeriodDelete,
    #[serde(rename = "users.update")]
    UsersPeriodUpdate,
    #[serde(rename = "users.login")]
    UsersPeriodLogin,
    #[serde(rename = "users.login_failure")]
    UsersPeriodLoginFailure,
    #[serde(rename = "users.logout")]
    UsersPeriodLogout,
    #[serde(rename = "users.accept_invite")]
    UsersPeriodAcceptInvite,
    #[serde(rename = "users.decline_invite")]
    UsersPeriodDeclineInvite,
    #[serde(rename = "users.token.create")]
    UsersPeriodTokenPeriodCreate,
    #[serde(rename = "users.token.delete")]
    UsersPeriodTokenPeriodDelete,
    #[serde(rename = "users.add_to_workspace")]
    UsersPeriodAddToWorkspace,
    #[serde(rename = "users.add_global")]
    UsersPeriodAddGlobal,
    #[serde(rename = "users.setpassword")]
    UsersPeriodSetpassword,
    #[serde(rename = "users.impersonate")]
    UsersPeriodImpersonate,
    #[serde(rename = "users.leave_workspace")]
    UsersPeriodLeaveWorkspace,
    #[serde(rename = "oauth.login")]
    OauthPeriodLogin,
    #[serde(rename = "oauth.login_failure")]
    OauthPeriodLoginFailure,
    #[serde(rename = "oauth.signup")]
    OauthPeriodSignup,
    #[serde(rename = "variables.create")]
    VariablesPeriodCreate,
    #[serde(rename = "variables.delete")]
    VariablesPeriodDelete,
    #[serde(rename = "variables.update")]
    VariablesPeriodUpdate,
    #[serde(rename = "flows.create")]
    FlowsPeriodCreate,
    #[serde(rename = "flows.update")]
    FlowsPeriodUpdate,
    #[serde(rename = "flows.delete")]
    FlowsPeriodDelete,
    #[serde(rename = "flows.archive")]
    FlowsPeriodArchive,
    #[serde(rename = "apps.create")]
    AppsPeriodCreate,
    #[serde(rename = "apps.update")]
    AppsPeriodUpdate,
    #[serde(rename = "apps.delete")]
    AppsPeriodDelete,
    #[serde(rename = "folder.create")]
    FolderPeriodCreate,
    #[serde(rename = "folder.update")]
    FolderPeriodUpdate,
    #[serde(rename = "folder.delete")]
    FolderPeriodDelete,
    #[serde(rename = "folder.add_owner")]
    FolderPeriodAddOwner,
    #[serde(rename = "folder.remove_owner")]
    FolderPeriodRemoveOwner,
    #[serde(rename = "group.create")]
    GroupPeriodCreate,
    #[serde(rename = "group.delete")]
    GroupPeriodDelete,
    #[serde(rename = "group.edit")]
    GroupPeriodEdit,
    #[serde(rename = "group.adduser")]
    GroupPeriodAdduser,
    #[serde(rename = "group.removeuser")]
    GroupPeriodRemoveuser,
    #[serde(rename = "igroup.create")]
    IgroupPeriodCreate,
    #[serde(rename = "igroup.delete")]
    IgroupPeriodDelete,
    #[serde(rename = "igroup.adduser")]
    IgroupPeriodAdduser,
    #[serde(rename = "igroup.removeuser")]
    IgroupPeriodRemoveuser,
    #[serde(rename = "variables.decrypt_secret")]
    VariablesPeriodDecryptSecret,
    #[serde(rename = "workspaces.edit_command_script")]
    WorkspacesPeriodEditCommandScript,
    #[serde(rename = "workspaces.edit_deploy_to")]
    WorkspacesPeriodEditDeployTo,
    #[serde(rename = "workspaces.edit_auto_invite_domain")]
    WorkspacesPeriodEditAutoInviteDomain,
    #[serde(rename = "workspaces.edit_webhook")]
    WorkspacesPeriodEditWebhook,
    #[serde(rename = "workspaces.edit_copilot_config")]
    WorkspacesPeriodEditCopilotConfig,
    #[serde(rename = "workspaces.edit_error_handler")]
    WorkspacesPeriodEditErrorHandler,
    #[serde(rename = "workspaces.create")]
    WorkspacesPeriodCreate,
    #[serde(rename = "workspaces.update")]
    WorkspacesPeriodUpdate,
    #[serde(rename = "workspaces.archive")]
    WorkspacesPeriodArchive,
    #[serde(rename = "workspaces.unarchive")]
    WorkspacesPeriodUnarchive,
    #[serde(rename = "workspaces.delete")]
    WorkspacesPeriodDelete,
}

impl Default for Operation {
    fn default() -> Operation {
        Self::JobsPeriodRun
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ActionKind {
    #[serde(rename = "Created")]
    Created,
    #[serde(rename = "Updated")]
    Updated,
    #[serde(rename = "Delete")]
    Delete,
    #[serde(rename = "Execute")]
    Execute,
}

impl Default for ActionKind {
    fn default() -> ActionKind {
        Self::Created
    }
}

