Repository: juspay/hyperswitch
File: crates/api_models/src/user.rs (Rust)

Code before:
#[derive(serde::Deserialize, Debug, serde::Serialize)]
pub struct CreateTenantUserRequest {
    pub name: Secret<String>,
    pub email: pii::Email,
    pub password: Secret<String>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub struct UserOrgMerchantCreateRequest {
    pub organization_name: Secret<String>,
    pub organization_details: Option<pii::SecretSerdeValue>,
    pub metadata: Option<pii::SecretSerdeValue>,
    pub merchant_name: Secret<String>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PlatformAccountCreateRequest {
    #[schema(max_length = 64, value_type = String, example = "organization_abc")]
    pub organization_name: Secret<String>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PlatformAccountCreateResponse {
    #[schema(value_type = String, max_length = 64, min_length = 1, example = "org_abc")]
    pub org_id: id_type::OrganizationId,
    #[schema(value_type = String, example = "organization_abc")]
    pub org_name: Option<String>,

    #[schema(value_type = OrganizationType, example = "standard")]
    pub org_type: common_enums::OrganizationType,
    #[schema(value_type = String, example = "merchant_abc")]
    pub merchant_id: id_type::MerchantId,
    #[schema(value_type = MerchantAccountType, example = "standard")]
    pub merchant_account_type: common_enums::MerchantAccountType,
}

#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct UserMerchantCreate {
    pub company_name: String,
    pub product_type: Option<common_enums::MerchantProductType>,
    pub merchant_account_type: Option<common_enums::MerchantAccountRequestType>,
}

#[derive(serde::Serialize, Debug, Clone)]
pub struct GetUserDetailsResponse {
    pub merchant_id: id_type::MerchantId,
    pub name: Secret<String>,
    pub email: pii::Email,
    pub verification_days_left: Option<i64>,
    pub role_id: String,
    // This field is added for audit/debug reasons

Review comment (suggestion):
```suggestion
    #[schema(value_type = Option<String>, example = "organization_abc")]
```

Code after:
#[derive(serde::Deserialize, Debug, serde::Serialize)]
pub struct CreateTenantUserRequest {
    pub name: Secret<String>,
    pub email: pii::Email,
    pub password: Secret<String>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub struct UserOrgMerchantCreateRequest {
    pub organization_name: Secret<String>,
    pub organization_details: Option<pii::SecretSerdeValue>,
    pub metadata: Option<pii::SecretSerdeValue>,
    pub merchant_name: Secret<String>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PlatformAccountCreateRequest {
    #[schema(max_length = 64, value_type = String, example = "organization_abc")]
    pub organization_name: Secret<String>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PlatformAccountCreateResponse {
    #[schema(value_type = String, max_length = 64, min_length = 1, example = "org_abc")]
    pub org_id: id_type::OrganizationId,
    #[schema(value_type = Option<String>, example = "organization_abc")]
    pub org_name: Option<String>,

    #[schema(value_type = OrganizationType, example = "standard")]
    pub org_type: common_enums::OrganizationType,
    #[schema(value_type = String, example = "merchant_abc")]
    pub merchant_id: id_type::MerchantId,
    #[schema(value_type = MerchantAccountType, example = "standard")]
    pub merchant_account_type: common_enums::MerchantAccountType,
}

#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct UserMerchantCreate {
    pub company_name: String,
    pub product_type: Option<common_enums::MerchantProductType>,
    pub merchant_account_type: Option<common_enums::MerchantAccountRequestType>,
}

#[derive(serde::Serialize, Debug, Clone)]
pub struct GetUserDetailsResponse {
    pub merchant_id: id_type::MerchantId,
    pub name: Secret<String>,
    pub email: pii::Email,
    pub verification_days_left: Option<i64>,
    pub role_id: String,
    // This field is added for audit/debug reasons