// Package user provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
package user

import (
	"time"

	"github.com/lib/pq"
	"github.com/meshery/schemas/models/core"
	openapi_types "github.com/oapi-codegen/runtime/types"
	"github.com/gofrs/uuid"
)

// Defines values for UserStatus.
const (
	Active    UserStatus = "active"
	Anonymous UserStatus = "anonymous"
	Inactive  UserStatus = "inactive"
	Pending   UserStatus = "pending"
)

// Defines values for UserEmailAddressSource.
const (
	Backfill      UserEmailAddressSource = "backfill"
	Consolidation UserEmailAddressSource = "consolidation"
	Manual        UserEmailAddressSource = "manual"
	Signup        UserEmailAddressSource = "signup"
)

// AccountDeletionEligibility Pre-check result returned before an account self-deletion is confirmed. Describes whether deleting the caller's account would also require or permit hard-deleting their organization and quantifies the blast radius. All fields are always present so the client can render the confirmation state deterministically.
type AccountDeletionEligibility struct {
	// CrossTenantSharedResourceCount Count of resources reachable from this organization that are also shared into a different, surviving organization; destroying them affects other tenants. When greater than zero the client must set confirmSharedResourceDestruction to proceed.
	CrossTenantSharedResourceCount int `json:"crossTenantSharedResourceCount" yaml:"crossTenantSharedResourceCount"`

	// HasActivePaidSubscription True when the organization has an active paid (non-"Personal"/free) plan subscription that must be cancelled before the organization can be hard-deleted.
	HasActivePaidSubscription bool `json:"hasActivePaidSubscription" yaml:"hasActivePaidSubscription"`

	// Impact Per-resource counts of the objects that would be destroyed when an organization is hard-deleted alongside the account.
	Impact AccountDeletionImpact `json:"impact" yaml:"impact"`

	// IsProviderOrg True when this is the shared Layer5 provider organization, which is never deletable regardless of membership.
	IsProviderOrg bool `json:"isProviderOrg" yaml:"isProviderOrg"`

	// IsSoleActiveMember True when the caller is the only active member of the organization, so deleting their account would leave the organization without any active members.
	IsSoleActiveMember bool `json:"isSoleActiveMember" yaml:"isSoleActiveMember"`

	// OrganizationId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	OrganizationId core.Uuid `json:"organizationId" yaml:"organizationId"`

	// OrganizationName Human-readable name of the organization evaluated for deletion. The client echoes this value back as organizationNameConfirmation when requesting deletion.
	OrganizationName string `json:"organizationName" yaml:"organizationName"`
}

// AccountDeletionImpact Per-resource counts of the objects that would be destroyed when an organization is hard-deleted alongside the account.
type AccountDeletionImpact struct {
	// AcademyRecords Number of academy records (challenges, certifications) that would be destroyed.
	AcademyRecords int `json:"academyRecords" yaml:"academyRecords"`

	// Connections Number of connections that would be destroyed.
	Connections int `json:"connections" yaml:"connections"`

	// Credentials Number of credentials that would be destroyed.
	Credentials int `json:"credentials" yaml:"credentials"`

	// Designs Number of designs that would be destroyed.
	Designs int `json:"designs" yaml:"designs"`

	// Environments Number of environments that would be destroyed.
	Environments int `json:"environments" yaml:"environments"`

	// Invitations Number of pending invitations that would be revoked.
	Invitations int `json:"invitations" yaml:"invitations"`

	// Members Number of organization members that would lose access.
	Members int `json:"members" yaml:"members"`

	// Views Number of views that would be destroyed.
	Views int `json:"views" yaml:"views"`

	// Workspaces Number of workspaces that would be destroyed.
	Workspaces int `json:"workspaces" yaml:"workspaces"`
}

// Adapter Placeholder for Adapter struct definition.
type Adapter = map[string]interface{}

// AnonymousFlowResponse Response returned after minting an anonymous user session: the session access token, the ID of the synthetic anonymous user, and the capability document for the session.
type AnonymousFlowResponse struct {
	// AccessToken JWT access token for the anonymous session.
	AccessToken string `json:"accessToken" yaml:"accessToken"`

	// Capabilities Capability document for the anonymous session. Untyped pending the provider-capabilities schema tracked separately in the identifier-uniformity program.
	Capabilities *map[string]interface{} `json:"capability,omitempty" yaml:"capability,omitempty"`

	// UserId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	UserID core.Uuid `json:"userId" yaml:"userId"`
}

// Grafana defines model for Grafana.
type Grafana struct {
	// GrafanaApiKey Grafana API key for the user configuration.
	GrafanaApiKey *string `json:"grafanaApiKey,omitempty" yaml:"grafanaApiKey,omitempty"`

	// GrafanaUrl Grafana URL for the user configuration.
	GrafanaUrl *string `json:"grafanaUrl,omitempty" yaml:"grafanaUrl,omitempty"`

	// SelectedBoardsConfigs Selected Grafana board configurations for the user.
	SelectedBoardsConfigs *[]SelectedGrafanaConfig `json:"selectedBoardsConfigs,omitempty" yaml:"selectedBoardsConfigs,omitempty"`
}

// GrafanaBoard Placeholder for GrafanaBoard definition (define fields as needed)
type GrafanaBoard = map[string]interface{}

// LoadTestPreferences defines model for LoadTestPreferences.
type LoadTestPreferences struct {
	// C Concurrent requests
	C *int `json:"c,omitempty" yaml:"c,omitempty"`

	// Gen Load generator
	Gen *string `json:"gen,omitempty" yaml:"gen,omitempty"`

	// Qps Queries per second
	Qps *int `json:"qps,omitempty" yaml:"qps,omitempty"`

	// T Duration
	T *string `json:"t,omitempty" yaml:"t,omitempty"`
}

// MentionMessage A single comment message included in a mention notification.
type MentionMessage struct {
	// AvatarURL URL to the comment author's avatar image.
	AvatarURL *string `json:"avatarUrl,omitempty" yaml:"avatarUrl,omitempty"`

	// FirstName First name of the comment author.
	FirstName *string `json:"firstName,omitempty" yaml:"firstName,omitempty"`

	// LastName Last name of the comment author.
	LastName *string `json:"lastName,omitempty" yaml:"lastName,omitempty"`

	// Message Text of the comment message.
	Message   *string           `json:"message,omitempty" yaml:"message,omitempty"`
	Timestamp core.Time `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`

	// UserId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	UserID *core.Uuid `json:"userId,omitempty" yaml:"userId,omitempty"`
}

// MentionNotificationPayload Request body for notifying users about a design comment: the users mentioned in the comment, the thread participants, and the comment messages to include in the notification email.
type MentionNotificationPayload struct {
	// DesignId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	DesignID core.Uuid `json:"designId" yaml:"designId"`

	// MentionUsers IDs of the users explicitly mentioned in the comment.
	MentionUsers *[]core.Uuid `json:"mentionUsers,omitempty" yaml:"mentionUsers,omitempty"`

	// Messages The comment messages to include in the notification email.
	Messages *[]MentionMessage `json:"messages,omitempty" yaml:"messages,omitempty"`

	// Participants IDs of the users participating in the comment thread.
	Participants *[]core.Uuid `json:"participants,omitempty" yaml:"participants,omitempty"`

	// UsersOptedOutOfNotifications IDs of the users who opted out of mention notifications.
	UsersOptedOutOfNotifications *[]core.Uuid `json:"usersOptedOutOfNotifications,omitempty" yaml:"usersOptedOutOfNotifications,omitempty"`
}

// OrganizationWithRoles An organization the user is a member of, together with the names of the roles assigned to that user within the organization. Returned as an item of User.organizations.organizationsWithRoles. The role names are dynamic, user-generated values (no fixed enumeration).
type OrganizationWithRoles struct {
	// Id A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	ID core.Uuid `db:"id" json:"id,omitempty" yaml:"id"`

	// Name Name of the organization.
	Name string `db:"name" json:"name,omitempty" yaml:"name,omitempty"`

	// Description Human readable description of the organization.
	Description *string `db:"description" json:"description,omitempty" yaml:"description,omitempty"`

	// Country Country associated with the organization.
	Country *string `db:"country" json:"country,omitempty" yaml:"country,omitempty"`

	// Region Region associated with the organization.
	Region *string `db:"region" json:"region,omitempty" yaml:"region,omitempty"`

	// Owner A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	Owner     *core.Uuid `db:"owner" json:"owner,omitempty" yaml:"owner,omitempty"`
	CreatedAt core.Time  `db:"created_at" json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
	UpdatedAt core.Time  `db:"updated_at" json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`

	// DeletedAt Timestamp when the organization was soft-deleted (null if not deleted).
	DeletedAt *core.NullTime `db:"deleted_at" json:"deletedAt,omitempty" yaml:"deletedAt,omitempty"`

	// RoleNames Names of the roles assigned to the user within this organization. Free-form, user-generated role names; not a fixed enumeration.
	RoleNames pq.StringArray `db:"role_names" json:"roleNames" yaml:"roleNames"`
}

// Panel Grafana panel structure imported from github.com/grafana-tools/sdk
type Panel = map[string]interface{}

// Preference defines model for Preference.
type Preference struct {
	// AnonymousPerfResults The anonymous perf results of the preference.
	AnonymousPerfResults bool `json:"anonymousPerfResults" yaml:"anonymousPerfResults"`

	// AnonymousUsageStats The anonymous usage stats of the preference.
	AnonymousUsageStats bool `json:"anonymousUsageStats" yaml:"anonymousUsageStats"`

	// DashboardPreferences The dashboard preferences of the preference.
	DashboardPreferences map[string]interface{} `json:"dashboardPreferences" yaml:"dashboardPreferences"`
	Grafana              *Grafana               `json:"grafana,omitempty" yaml:"grafana,omitempty"`
	LoadTestPrefs        *LoadTestPreferences   `json:"loadTestPrefs,omitempty" yaml:"loadTestPrefs,omitempty"`

	// MeshAdapters The mesh adapters of the preference.
	MeshAdapters *[]Adapter  `json:"meshAdapters,omitempty" yaml:"meshAdapters,omitempty"`
	Prometheus   *Prometheus `json:"prometheus,omitempty" yaml:"prometheus,omitempty"`

	// RemoteProviderPreferences The remote provider preferences of the preference.
	RemoteProviderPreferences map[string]interface{} `json:"remoteProviderPreferences" yaml:"remoteProviderPreferences"`

	// SelectedOrganizationId ID of the associated selectedOrganization.
	SelectedOrganizationId uuid.UUID `json:"selectedOrganizationId" yaml:"selectedOrganizationId"`

	// SelectedWorkspaceForOrganizations The selected workspace for organizations of the preference.
	SelectedWorkspaceForOrganizations map[string]string `json:"selectedWorkspaceForOrganizations" yaml:"selectedWorkspaceForOrganizations"`

	// UpdatedAt Timestamp of when the resource was last updated.
	UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`

	// UsersExtensionPreferences The users extension preferences of the preference.
	UsersExtensionPreferences map[string]interface{} `json:"usersExtensionPreferences" yaml:"usersExtensionPreferences"`
}

// ProfileOverview Aggregate counts shown on the current user's profile overview.
type ProfileOverview struct {
	// KubernetesContexts Number of Kubernetes contexts owned by the user.
	KubernetesContexts int `json:"k8sCount" yaml:"k8sCount"`

	// PatternsCount Number of designs owned by the user.
	PatternsCount int `json:"patternCount" yaml:"patternCount"`
}

// Prometheus defines model for Prometheus.
type Prometheus struct {
	// PrometheusUrl The prometheus URL of the prometheus.
	PrometheusUrl *string `json:"prometheusUrl,omitempty" yaml:"prometheusUrl,omitempty"`

	// SelectedPrometheusBoardsConfigs The selected prometheus boards configs of the prometheus.
	SelectedPrometheusBoardsConfigs *[]SelectedGrafanaConfig `json:"selectedPrometheusBoardsConfigs,omitempty" yaml:"selectedPrometheusBoardsConfigs,omitempty"`
}

// RecentActivityPage Paginated recent-activity feed for a user's public profile.
type RecentActivityPage struct {
	// Activities The activity entries on the current page.
	Activities *[]UserActivity `json:"activities,omitempty" yaml:"activities,omitempty"`

	// Page Current page number of the result set.
	Page *int `json:"page,omitempty" yaml:"page,omitempty"`

	// PageSize Number of items per page.
	PageSize *int `json:"pageSize,omitempty" yaml:"pageSize,omitempty"`

	// TotalCount Total number of items available.
	TotalCount *int `json:"totalCount,omitempty" yaml:"totalCount,omitempty"`
}

// SelectedGrafanaConfig defines model for SelectedGrafanaConfig.
type SelectedGrafanaConfig struct {
	// Board Placeholder for GrafanaBoard definition (define fields as needed)
	Board *GrafanaBoard `json:"board,omitempty" yaml:"board,omitempty"`

	// Panels Panels selected for the Grafana board configuration.
	Panels *[]Panel `json:"panels,omitempty" yaml:"panels,omitempty"`

	// TemplateVars Template variables applied to the selected Grafana board configuration.
	TemplateVars *[]string `json:"templateVars,omitempty" yaml:"templateVars,omitempty"`
}

// Social Various online profiles associated with the user account, like GitHub, LinkedIn, X, and so on.
type Social struct {
	// Link The link of the social.
	Link string `json:"link" yaml:"link"`

	// Site The site of the social.
	Site string `json:"site" yaml:"site"`
}

// TeamWithRoles A team the user is a member of, together with the names of the roles assigned to that user within the team. Returned as an item of User.teams.teamsWithRoles. The role names are dynamic, user-generated values (no fixed enumeration).
type TeamWithRoles struct {
	// Id A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	ID core.Uuid `db:"id" json:"id,omitempty" yaml:"id"`

	// Name Name of the team.
	Name string `db:"name" json:"name,omitempty" yaml:"name,omitempty"`

	// Description Human readable description of the team.
	Description *string `db:"description" json:"description,omitempty" yaml:"description,omitempty"`

	// Owner A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	Owner *core.Uuid `db:"owner" json:"owner,omitempty" yaml:"owner,omitempty"`

	// Metadata Free-form metadata associated with the team.
	Metadata  core.Map          `db:"metadata" json:"metadata,omitempty" yaml:"metadata,omitempty"`
	CreatedAt core.Time `db:"created_at" json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
	UpdatedAt core.Time `db:"updated_at" json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`

	// DeletedAt Timestamp when the team was soft-deleted (null if not deleted).
	DeletedAt *core.NullTime `db:"deleted_at" json:"deletedAt,omitempty" yaml:"deletedAt,omitempty"`

	// RoleNames Names of the roles assigned to the user within this team. Free-form, user-generated role names; not a fixed enumeration.
	RoleNames pq.StringArray `db:"role_names" json:"roleNames" yaml:"roleNames"`
}

// User Represents a user
type User struct {
	AcceptedTermsAt core.Time `db:"accepted_terms_at" json:"acceptedTermsAt" yaml:"acceptedTermsAt,omitempty"`

	// AvatarUrl URL to user's avatar image
	AvatarUrl *string `db:"avatar_url" json:"avatarUrl" yaml:"avatarUrl"`

	// Bio User's biography or description
	Bio *string `db:"bio" json:"bio" yaml:"bio"`

	// Country User's country information stored as JSONB
	Country   core.Map          `db:"country" json:"country" yaml:"country"`
	CreatedAt core.Time `db:"created_at" json:"createdAt" yaml:"createdAt"`

	// DeletedAt Timestamp when the user record was soft-deleted (null if not deleted)
	DeletedAt *core.NullTime `db:"deleted_at" json:"deletedAt" yaml:"deletedAt"`

	// Email User's email address
	Email          openapi_types.Email `db:"email" json:"email" yaml:"email"`
	FirstLoginTime core.Time   `db:"first_login_time" json:"firstLoginTime" yaml:"firstLoginTime,omitempty"`

	// FirstName User's first name
	FirstName string `db:"first_name" json:"firstName" yaml:"firstName"`

	// Id A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	ID            core.Uuid `db:"id" json:"id" yaml:"id"`
	LastLoginTime core.Time `db:"last_login_time" json:"lastLoginTime" yaml:"lastLoginTime"`

	// LastName User's last name
	LastName string `db:"last_name" json:"lastName" yaml:"lastName"`

	// Organizations Organizations the user belongs to with role information
	Organizations *struct {
		// OrganizationsWithRoles Organization memberships for the user with their assigned roles.
		OrganizationsWithRoles *[]OrganizationWithRoles `db:"organizations_with_roles" json:"organizationsWithRoles" yaml:"organizationsWithRoles"`

		// TotalCount Total number of organization memberships returned for the user.
		TotalCount *int `db:"total_count" json:"totalCount" yaml:"totalCount"`
	} `db:"organizations" json:"organizations" yaml:"organizations"`
	Preferences *Preference `db:"preferences" json:"preferences" yaml:"preferences,omitempty"`

	// Provider Authentication provider (e.g., Google, Github)
	Provider string `db:"provider" json:"provider" yaml:"provider"`

	// Region User's region information stored as JSONB
	Region core.Map `db:"region" json:"region" yaml:"region"`

	// RoleNames Names of the global roles assigned to the user. Free-form, user-generated values sourced from the roles table (role_name is a varchar, not a fixed enumeration); the seeded system roles such as "admin", "organization admin" and "user" are a subset, not the whole set.
	RoleNames pq.StringArray `db:"role_names" json:"roleNames" yaml:"roleNames"`

	// Socials Various online profiles associated with the user account
	Socials *UserSocials `db:"socials" json:"socials" yaml:"socials"`

	// Status User account status
	Status UserStatus `db:"status" json:"status" yaml:"status"`

	// Teams Teams the user belongs to with role information
	Teams *struct {
		// TeamsWithRoles Team memberships for the user with their assigned roles.
		TeamsWithRoles *[]TeamWithRoles `db:"teams_with_roles" json:"teamsWithRoles" yaml:"teamsWithRoles"`

		// TotalCount Total number of team memberships returned for the user.
		TotalCount *int `db:"total_count" json:"totalCount" yaml:"totalCount"`
	} `db:"teams" json:"teams" yaml:"teams"`
	UpdatedAt core.Time `db:"updated_at" json:"updatedAt" yaml:"updatedAt"`

	// UserId Legacy IdP-derived identifier. Removed in v1beta3; resolve users by id or email.
	// Deprecated: this property has been marked as deprecated upstream, but no `x-deprecated-reason` was set
	UserId string `db:"user_id" json:"userId" yaml:"userId"`
}

// UserStatus User account status
type UserStatus string

// UserActivity A single entry in a user's recent-activity feed. A narrow projection of the stored event record (id, category, action, description, owner and timestamps). The pre-migration meshery-cloud serialization emitted additional zero-valued event fields; those disappear once the server consumes this generated type.
type UserActivity struct {
	// Action Action recorded by the activity.
	Action *string `db:"action" json:"action" yaml:"action"`

	// Category Resource category on which the activity occurred.
	Category  *string           `db:"category" json:"category" yaml:"category"`
	CreatedAt core.Time `db:"created_at" json:"createdAt" yaml:"createdAt,omitempty"`

	// Description Human-readable description of the activity. Email addresses are redacted for non-privileged viewers.
	Description *string `db:"description" json:"description" yaml:"description"`

	// Id A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	ID *core.Uuid `db:"id" json:"id" yaml:"id,omitempty"`

	// Owner A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	Owner     *core.Uuid `db:"owner" json:"owner" yaml:"owner,omitempty"`
	UpdatedAt core.Time  `db:"updated_at" json:"updatedAt" yaml:"updatedAt,omitempty"`
}

// UserEmailAddress One email address associated with a user account. A user has exactly one primary address (mirrored in users.email) and any number of secondary addresses accumulated from account consolidation or explicit addition. Uniqueness across live addresses is enforced case-insensitively.
type UserEmailAddress struct {
	CreatedAt core.Time `db:"created_at" json:"createdAt" yaml:"createdAt"`

	// DeletedAt SQL null Timestamp to handle null values of time.
	DeletedAt core.NullTime `db:"deleted_at" json:"deletedAt" yaml:"deletedAt"`

	// Email The email address
	Email openapi_types.Email `db:"email" json:"email" yaml:"email"`

	// Id A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	ID core.Uuid `db:"id" json:"id" yaml:"id"`

	// IsPrimary Exactly one live primary address per user; mirrors users.email
	IsPrimary bool `db:"is_primary" json:"isPrimary" yaml:"isPrimary"`

	// Source How this address became associated with the account
	Source    UserEmailAddressSource `db:"source" json:"source" yaml:"source"`
	UpdatedAt core.Time      `db:"updated_at" json:"updatedAt" yaml:"updatedAt"`

	// UserId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	UserID core.Uuid `db:"owner" json:"userId" yaml:"userId"`

	// Verified Whether the address was verified (per Kratos verifiable addresses) at record time
	Verified bool `db:"verified" json:"verified" yaml:"verified"`
}

// UserEmailAddressSource How this address became associated with the account
type UserEmailAddressSource string

// UsersPageForAdmin Paginated list of users with organization and team role context
type UsersPageForAdmin struct {
	// Data The data of the userspageforadmin.
	Data *[]User `json:"data,omitempty" yaml:"data,omitempty"`

	// Page Current page number of the result set.
	Page *int `json:"page,omitempty" yaml:"page,omitempty"`

	// PageSize Number of items per page.
	PageSize *int `json:"pageSize,omitempty" yaml:"pageSize,omitempty"`

	// TotalCount Total number of items available.
	TotalCount *int `json:"totalCount,omitempty" yaml:"totalCount,omitempty"`
}

// UsersPageForNonAdmin Deprecated: the public users directory (/api/users, getUsers) is documented by the v1beta3 user construct's PublicUsersPage, which reflects the reduced projection actually served since the directory was hardened. This full-User page shape was never what the endpoint returned post-hardening and is retained only for compatibility with existing type imports.
type UsersPageForNonAdmin struct {
	// Data The data of the userspagefornonadmin.
	Data *[]User `json:"data,omitempty" yaml:"data,omitempty"`

	// Page Current page number of the result set.
	Page *int `json:"page,omitempty" yaml:"page,omitempty"`

	// PageSize Number of items per page.
	PageSize *int `json:"pageSize,omitempty" yaml:"pageSize,omitempty"`

	// TotalCount Total number of items available.
	TotalCount *int `json:"totalCount,omitempty" yaml:"totalCount,omitempty"`
}

// Filter defines model for filter.
type Filter = string

// Id A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
// Id defines model for id.
type Id = uuid.UUID

// Order defines model for order.
type Order = string

// Page defines model for page.
type Page = int

// PageSize defines model for pageSize.
type PageSize = int

// Search defines model for search.
type Search = string

// TeamId defines model for teamId.
type TeamId = uuid.UUID

// UserId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
type UserId = core.Uuid
