package kb

import "time"

// KnowledgeBase is a MeshX-owned workspace knowledge base.
type KnowledgeBase struct {
	ID                                  string                     `gorm:"primaryKey;size:64"`
	WorkspaceID                         string                     `gorm:"size:64;not null;index:idx_kb_workspace_updated;index:idx_kb_workspace_publication,priority:1"`
	GroupID                             string                     `gorm:"column:group_id;size:64;not null;default:'';index:idx_kb_workspace_group"`
	Slug                                string                     `gorm:"size:255;not null;default:'';index"`
	Name                                string                     `gorm:"size:255;not null"`
	Description                         string                     `gorm:"type:text;not null"`
	StorageScope                        string                     `gorm:"size:32;not null;default:'personal'"`
	StorageOwnerLogin                   string                     `gorm:"size:128;not null;default:''"`
	DefaultWorkspaceMemberRole          string                     `gorm:"column:default_workspace_member_role;size:32;not null;default:'view'"`
	DefaultRepositoryAccessProfile      string                     `gorm:"column:default_repository_access_profile;size:32;not null;default:'none'"`
	AllowKnowledgeQAWithoutSourceAccess bool                       `gorm:"column:allow_knowledge_qa_without_source_access;not null;default:false"`
	PublicationState                    string                     `gorm:"column:publication_state;size:32;not null;default:'official';index:idx_kb_workspace_publication,priority:2"`
	WorkingRevision                     string                     `gorm:"column:working_revision;size:64;not null;default:''"`
	PublishedRevision                   string                     `gorm:"column:published_revision;size:64;not null;default:''"`
	PublishedAt                         *time.Time                 `gorm:"column:published_at;index"`
	IsActive                            bool                       `gorm:"not null;default:true;index"`
	RetrievalPolicy                     string                     `gorm:"column:retrieval_policy;type:text;not null"`
	SourceCollectionState               string                     `gorm:"column:source_collection_state;type:text;not null"`
	LastAccessedAt                      *time.Time                 `gorm:"index"`
	CreatedBy                           string                     `gorm:"size:64;not null"`
	UpdatedBy                           string                     `gorm:"size:64;not null"`
	CreatedAt                           time.Time                  `gorm:"not null"`
	UpdatedAt                           time.Time                  `gorm:"not null;index:idx_kb_workspace_updated"`
	DeletedAt                           *time.Time                 `gorm:"index"`
	Pinned                              bool                       `gorm:"-"`
	PinnedAt                            *time.Time                 `gorm:"-"`
	Role                                string                     `gorm:"-"`
	CanManage                           bool                       `gorm:"-"`
	CanEditOfficial                     bool                       `gorm:"-"`
	CanConvertToDraft                   bool                       `gorm:"-"`
	RepositoryAccessProfile             string                     `gorm:"-"`
	RepositoryAccessStatus              string                     `gorm:"-"`
	Group                               *KnowledgeBaseGroup        `gorm:"-"`
	Tags                                []KnowledgeBaseTag         `gorm:"-"`
	SourceCount                         int64                      `gorm:"-"`
	SetupSummary                        *KnowledgeBaseSetupSummary `gorm:"-"`
}

func (KnowledgeBase) TableName() string { return "knowledge_bases" }

// KnowledgeBaseGroup is the single primary collection section assigned to a
// knowledge base. One default group is retained per workspace so existing and
// newly created knowledge bases always have a durable section.
type KnowledgeBaseGroup struct {
	ID          string    `gorm:"primaryKey;size:64"`
	WorkspaceID string    `gorm:"size:64;not null;uniqueIndex:uk_kb_groups_workspace_name;index:idx_kb_groups_workspace_order"`
	Name        string    `gorm:"size:100;not null;uniqueIndex:uk_kb_groups_workspace_name"`
	Description string    `gorm:"type:text;not null"`
	Color       string    `gorm:"size:7;not null"`
	SortOrder   int       `gorm:"not null;default:0;index:idx_kb_groups_workspace_order"`
	IsDefault   bool      `gorm:"not null;default:false;index"`
	CreatedBy   string    `gorm:"size:64;not null"`
	UpdatedBy   string    `gorm:"size:64;not null"`
	CreatedAt   time.Time `gorm:"not null"`
	UpdatedAt   time.Time `gorm:"not null;index"`
}

func (KnowledgeBaseGroup) TableName() string { return "knowledge_base_groups" }

// KnowledgeBaseTag is a workspace-scoped label that can be assigned to many
// knowledge bases across their primary groups.
type KnowledgeBaseTag struct {
	ID          string    `gorm:"primaryKey;size:64"`
	WorkspaceID string    `gorm:"size:64;not null;uniqueIndex:uk_kb_tags_workspace_name;index:idx_kb_tags_workspace_order"`
	Name        string    `gorm:"size:64;not null;uniqueIndex:uk_kb_tags_workspace_name"`
	Color       string    `gorm:"size:7;not null"`
	SortOrder   int       `gorm:"not null;default:0;index:idx_kb_tags_workspace_order"`
	CreatedBy   string    `gorm:"size:64;not null"`
	UpdatedBy   string    `gorm:"size:64;not null"`
	CreatedAt   time.Time `gorm:"not null"`
	UpdatedAt   time.Time `gorm:"not null;index"`
}

func (KnowledgeBaseTag) TableName() string { return "knowledge_base_tags" }

// KnowledgeBaseTagAssignment joins the reusable tag vocabulary to knowledge
// bases. The workspace key keeps every lookup and cleanup explicitly scoped.
type KnowledgeBaseTagAssignment struct {
	WorkspaceID     string    `gorm:"primaryKey;size:64;index:idx_kb_tag_assignments_tag,priority:1"`
	KnowledgeBaseID string    `gorm:"primaryKey;size:64"`
	TagID           string    `gorm:"primaryKey;size:64;index:idx_kb_tag_assignments_tag,priority:2"`
	CreatedBy       string    `gorm:"size:64;not null"`
	CreatedAt       time.Time `gorm:"not null"`
}

func (KnowledgeBaseTagAssignment) TableName() string {
	return "knowledge_base_tag_assignments"
}

// KnowledgeBasePin pins a knowledge base for one principal in a workspace.
type KnowledgeBasePin struct {
	WorkspaceID     string    `gorm:"primaryKey;size:64"`
	PrincipalID     string    `gorm:"primaryKey;size:64"`
	KnowledgeBaseID string    `gorm:"primaryKey;size:64;index"`
	CreatedAt       time.Time `gorm:"not null"`
	UpdatedAt       time.Time `gorm:"not null;index"`
}

func (KnowledgeBasePin) TableName() string { return "knowledge_base_pins" }

// KnowledgeBaseGrant grants a user or agent a role on one knowledge base.
type KnowledgeBaseGrant struct {
	ID                      string    `gorm:"primaryKey;size:64"`
	WorkspaceID             string    `gorm:"size:64;not null;index:idx_kb_grants_subject;uniqueIndex:uk_kb_grants_subject"`
	KnowledgeBaseID         string    `gorm:"size:64;not null;index:idx_kb_grants_kb;uniqueIndex:uk_kb_grants_subject"`
	SubjectType             string    `gorm:"size:32;not null;index:idx_kb_grants_subject;uniqueIndex:uk_kb_grants_subject"`
	SubjectID               string    `gorm:"size:64;not null;index:idx_kb_grants_subject;uniqueIndex:uk_kb_grants_subject"`
	Role                    string    `gorm:"size:32;not null;default:'view'"`
	RepositoryAccessProfile string    `gorm:"size:32;not null;default:'none'"`
	CreatedBy               string    `gorm:"size:64;not null"`
	UpdatedBy               string    `gorm:"size:64;not null"`
	CreatedAt               time.Time `gorm:"not null"`
	UpdatedAt               time.Time `gorm:"not null;index"`
}

func (KnowledgeBaseGrant) TableName() string { return "knowledge_base_grants" }

// KnowledgeBaseSourceRepositoryAccessOverride stores a per-source repository
// access override for one explicit human KB permission grant. Absence means the
// grant inherits KnowledgeBaseGrant.RepositoryAccessProfile.
type KnowledgeBaseSourceRepositoryAccessOverride struct {
	ID                      string    `gorm:"primaryKey;size:64"`
	WorkspaceID             string    `gorm:"size:64;not null;index:idx_kb_src_repo_access_overrides_grant;index:idx_kb_src_repo_access_override_lookup,priority:1;uniqueIndex:uk_kb_src_repo_access_override"`
	KnowledgeBaseID         string    `gorm:"size:64;not null;index:idx_kb_src_repo_access_overrides_grant;uniqueIndex:uk_kb_src_repo_access_override"`
	GrantID                 string    `gorm:"size:64;not null;index:idx_kb_src_repo_access_overrides_grant;index:idx_kb_src_repo_access_override_lookup,priority:2;uniqueIndex:uk_kb_src_repo_access_override"`
	SourceID                string    `gorm:"size:64;not null;index:idx_kb_src_repo_access_overrides_source;index:idx_kb_src_repo_access_override_lookup,priority:3;uniqueIndex:uk_kb_src_repo_access_override"`
	RepoRole                string    `gorm:"size:64;not null;index:idx_kb_src_repo_access_override_lookup,priority:4;uniqueIndex:uk_kb_src_repo_access_override"`
	SubjectType             string    `gorm:"size:32;not null"`
	SubjectID               string    `gorm:"size:64;not null"`
	RepositoryAccessProfile string    `gorm:"size:32;not null;default:'none'"`
	CreatedBy               string    `gorm:"size:64;not null"`
	UpdatedBy               string    `gorm:"size:64;not null"`
	CreatedAt               time.Time `gorm:"not null"`
	UpdatedAt               time.Time `gorm:"not null;index"`
}

func (KnowledgeBaseSourceRepositoryAccessOverride) TableName() string {
	return "knowledge_base_source_repository_access_overrides"
}

// Source is a knowledge-base source indexed or previewed by MeshX.
type Source struct {
	ID                              string                `gorm:"primaryKey;size:64"`
	WorkspaceID                     string                `gorm:"size:64;not null;index:idx_kb_sources_kb_order"`
	KnowledgeBaseID                 string                `gorm:"size:64;not null;index:idx_kb_sources_kb_order"`
	SourceType                      string                `gorm:"column:source_type;size:64;not null;default:'file_repository';index"`
	Status                          string                `gorm:"size:64;not null;default:'ready';index"`
	Name                            string                `gorm:"size:255;not null"`
	Description                     string                `gorm:"type:text;not null"`
	DefaultRef                      string                `gorm:"size:255;not null;default:''"`
	IndexingMode                    string                `gorm:"size:64;not null;default:'repo_wiki_and_files'"`
	SyncStatus                      string                `gorm:"size:64;not null;default:'ready';index"`
	IndexStatus                     string                `gorm:"size:64;not null;default:'ready';index"`
	AnalysisStatus                  string                `gorm:"size:64;not null;default:'pending';index"`
	FreshnessStatus                 string                `gorm:"size:64;not null;default:'unknown';index"`
	Config                          string                `gorm:"column:config_json;type:text;not null"`
	LastError                       string                `gorm:"type:text;not null"`
	LastSyncAt                      *time.Time            `gorm:"index"`
	LastIndexAt                     *time.Time            `gorm:"index"`
	LastAnalysisAt                  *time.Time            `gorm:"index"`
	CreatedBy                       string                `gorm:"size:64;not null"`
	UpdatedBy                       string                `gorm:"size:64;not null"`
	CreatedAt                       time.Time             `gorm:"not null"`
	UpdatedAt                       time.Time             `gorm:"not null;index:idx_kb_sources_kb_order"`
	DeletedAt                       *time.Time            `gorm:"index"`
	Mirror                          *SourceMirror         `gorm:"-"`
	ImportProgress                  *SourceImportProgress `gorm:"-"`
	SourceRepositoryAccessProfile   string                `gorm:"-"`
	SourceRepositoryAccessStatus    string                `gorm:"-"`
	InsightsRepositoryAccessProfile string                `gorm:"-"`
	InsightsRepositoryAccessStatus  string                `gorm:"-"`
}

func (Source) TableName() string { return "knowledge_base_sources" }

// SourceImportProgress is a display projection derived from durable source and
// job state. It is intentionally not persisted on the source row.
type SourceImportProgress struct {
	State          string
	Severity       string
	Phase          string
	Stage          string
	Message        string
	Percent        *int
	CurrentJobID   string
	CurrentJobType string
	StartedAt      *time.Time
	UpdatedAt      *time.Time
	FinishedAt     *time.Time
	LastError      string
	Steps          []SourceImportProgressStep
}

type SourceImportProgressStep struct {
	ID         string
	Phase      string
	Stage      string
	Status     string
	Optional   bool
	Message    string
	Error      string
	StartedAt  *time.Time
	UpdatedAt  *time.Time
	FinishedAt *time.Time
}

// SourceMirror stores external Git pull mirror metadata for a KB source.
// RemoteURL is sanitized for display and CredentialRef points at a secret;
// secret plaintext must not be persisted in this table.
type SourceMirror struct {
	SourceID           string                         `gorm:"primaryKey;size:64"`
	WorkspaceID        string                         `gorm:"size:64;not null;index:idx_kb_source_mirrors_workspace"`
	KnowledgeBaseID    string                         `gorm:"size:64;not null;index:idx_kb_source_mirrors_kb"`
	UpstreamType       string                         `gorm:"size:64;not null;default:'generic_git';index"`
	RemoteURL          string                         `gorm:"type:text;not null"`
	CredentialRef      string                         `gorm:"size:255;not null;default:''"`
	DefaultRef         string                         `gorm:"size:255;not null;default:''"`
	DefaultRefExplicit *bool                          `gorm:"column:default_ref_explicit"`
	IntervalSeconds    int                            `gorm:"not null;default:0"`
	Enabled            bool                           `gorm:"not null;default:false;index"`
	SyncStatus         string                         `gorm:"size:64;not null;default:'idle';index"`
	LastSyncAt         *time.Time                     `gorm:"index"`
	LastSuccessAt      *time.Time                     `gorm:"index"`
	NextSyncAt         *time.Time                     `gorm:"index"`
	LastError          string                         `gorm:"type:text;not null"`
	LastMirroredCommit string                         `gorm:"size:255;not null;default:''"`
	CreatedBy          string                         `gorm:"size:64;not null"`
	UpdatedBy          string                         `gorm:"size:64;not null"`
	CreatedAt          time.Time                      `gorm:"not null"`
	UpdatedAt          time.Time                      `gorm:"not null;index"`
	CredentialSummary  *SourceMirrorCredentialSummary `gorm:"-"`
}

func (SourceMirror) TableName() string { return "knowledge_base_source_mirrors" }

type SourceMirrorCredentialSummary struct {
	Kind              string
	DisplayName       string
	OwnerPrincipalID  string
	ProviderType      string
	ProviderBaseURL   string
	Status            string
	LastUsedAt        *time.Time
	ExpiresAt         *time.Time
	LinkedSourceCount int64
}

// AnalysisRun records source analysis inputs and insights outputs.
type AnalysisRun struct {
	ID                    string     `gorm:"primaryKey;size:64"`
	WorkspaceID           string     `gorm:"size:64;not null;index:idx_kb_analysis_runs_source"`
	KnowledgeBaseID       string     `gorm:"size:64;not null;index:idx_kb_analysis_runs_source"`
	SourceID              string     `gorm:"size:64;not null;index:idx_kb_analysis_runs_source"`
	Trigger               string     `gorm:"size:64;not null;default:'';index"`
	Status                string     `gorm:"size:64;not null;default:'pending';index"`
	InputKind             string     `gorm:"size:64;not null;default:''"`
	InputSourceCommitSHA  string     `gorm:"size:128;not null;default:''"`
	OutputRepoRole        string     `gorm:"size:64;not null;default:'insights'"`
	OutputCommitSHA       string     `gorm:"size:128;not null;default:''"`
	PublishedWikiRevision string     `gorm:"size:128;not null;default:''"`
	Progress              string     `gorm:"column:progress_json;type:text;not null"`
	Error                 string     `gorm:"type:text;not null"`
	CreatedBy             string     `gorm:"size:64;not null"`
	StartedAt             *time.Time `gorm:"index"`
	CompletedAt           *time.Time `gorm:"index"`
	CreatedAt             time.Time  `gorm:"not null"`
	UpdatedAt             time.Time  `gorm:"not null;index"`
}

func (AnalysisRun) TableName() string { return "knowledge_base_analysis_runs" }

// SourceRevision is the MeshX authority for source/materialization/insights revision relationships.
type SourceRevision struct {
	ID                      string     `gorm:"primaryKey;size:64"`
	WorkspaceID             string     `gorm:"size:64;not null;index:idx_kb_source_revisions_current"`
	KnowledgeBaseID         string     `gorm:"size:64;not null;index:idx_kb_source_revisions_current"`
	SourceID                string     `gorm:"size:64;not null;index:idx_kb_source_revisions_current"`
	SourceCommitSHA         string     `gorm:"size:128;not null;default:''"`
	SourceContentID         string     `gorm:"size:64;not null;default:'';index:idx_kb_source_revision_content"`
	SourceContentVersionID  string     `gorm:"size:64;not null;default:'';index:idx_kb_source_revision_content"`
	SourceContentVerifiedAt *time.Time `gorm:"index"`
	InsightsCommitSHA       string     `gorm:"size:128;not null;default:''"`
	UADashboardCommitSHA    string     `gorm:"column:ua_dashboard_commit_sha;size:128;not null;default:''"`
	UADashboardManifestJSON string     `gorm:"column:ua_dashboard_manifest_json;type:varbinary(16384);not null;default:''"`
	UADashboardPublishedAt  *time.Time `gorm:"column:ua_dashboard_published_at"`
	AnalysisRunID           string     `gorm:"size:64;not null;default:'';index"`
	PublishedWikiRevision   string     `gorm:"size:128;not null;default:''"`
	FreshnessStatus         string     `gorm:"size:64;not null;default:'current';index"`
	IsCurrent               bool       `gorm:"not null;default:true;index:idx_kb_source_revisions_current"`
	CreatedAt               time.Time  `gorm:"not null"`
	UpdatedAt               time.Time  `gorm:"not null;index"`
}

func (SourceRevision) TableName() string { return "knowledge_base_source_revisions" }

// SourceContentMapping records the verified, storage-neutral result of one
// legacy AGS commit import. Migration retry state is intentionally not stored:
// a retry resolves this exact mapping or reuses the Content Store operation.
type SourceContentMapping struct {
	ID                        string     `gorm:"primaryKey;size:64"`
	WorkspaceID               string     `gorm:"size:64;not null;index:idx_kb_source_content_mapping_scope;index:idx_kb_source_content_mapping_content,priority:1"`
	KnowledgeBaseID           string     `gorm:"size:64;not null;index:idx_kb_source_content_mapping_scope;index:idx_kb_source_content_mapping_content,priority:2"`
	SourceID                  string     `gorm:"size:64;not null;index:idx_kb_source_content_mapping_scope;index:idx_kb_source_content_mapping_content,priority:3"`
	SourceRevisionID          string     `gorm:"size:64;not null;index:idx_kb_source_content_mapping_scope"`
	RepositoryRole            string     `gorm:"size:64;not null;index:idx_kb_source_content_mapping_content,priority:5"`
	RepositoryID              string     `gorm:"column:ags_repository_id;size:64;not null;uniqueIndex:uk_kb_source_content_mapping_source,priority:1"`
	CanonicalBranch           string     `gorm:"size:255;not null"`
	CommitSHA                 string     `gorm:"column:ags_commit_sha;size:64;not null;uniqueIndex:uk_kb_source_content_mapping_source,priority:2"`
	ContentID                 string     `gorm:"size:64;not null;index:idx_kb_source_content_mapping_scope;index:idx_kb_source_content_mapping_content,priority:4"`
	ContentVersionID          string     `gorm:"size:64;not null;uniqueIndex"`
	RootDigest                string     `gorm:"size:64;not null"`
	FileCount                 int        `gorm:"not null"`
	SizeBytes                 int64      `gorm:"not null"`
	SourceCommittedAt         time.Time  `gorm:"not null;index"`
	SearchProjectionDigest    string     `gorm:"size:64;not null;default:''"`
	SearchDocumentCount       int        `gorm:"not null;default:0"`
	SearchTextBytes           int64      `gorm:"not null;default:0"`
	SearchProjectionTruncated bool       `gorm:"not null;default:false"`
	SearchProjectedAt         *time.Time `gorm:"index"`
	VerifiedAt                *time.Time `gorm:"index"`
	CreatedAt                 time.Time  `gorm:"not null"`
	UpdatedAt                 time.Time  `gorm:"not null"`
}

func (SourceContentMapping) TableName() string {
	return "knowledge_base_source_content_mappings"
}

// SourceSearchDocument is the bounded, exact-version search projection built
// by the KB source importer. It never discovers content at request time.
type SourceSearchDocument struct {
	MappingID        string    `gorm:"primaryKey;size:64"`
	Ordinal          int       `gorm:"primaryKey"`
	WorkspaceID      string    `gorm:"size:64;not null;index:idx_kb_source_search_version,priority:1"`
	KnowledgeBaseID  string    `gorm:"size:64;not null"`
	SourceID         string    `gorm:"size:64;not null;index:idx_kb_source_search_version,priority:2"`
	SourceRevisionID string    `gorm:"size:64;not null"`
	ContentID        string    `gorm:"size:64;not null;index:idx_kb_source_search_version,priority:3"`
	ContentVersionID string    `gorm:"size:64;not null;index:idx_kb_source_search_version,priority:4"`
	Path             string    `gorm:"type:text;not null"`
	Title            string    `gorm:"size:255;not null"`
	SearchText       string    `gorm:"type:mediumtext;not null"`
	TextBytes        int       `gorm:"not null"`
	CreatedAt        time.Time `gorm:"not null"`
}

func (SourceSearchDocument) TableName() string {
	return "knowledge_base_source_search_documents"
}

// Job stores MeshX KB materialization and indexing jobs.
type Job struct {
	ID              string     `gorm:"primaryKey;size:64"`
	WorkspaceID     string     `gorm:"size:64;not null;index:idx_kb_jobs_status"`
	KnowledgeBaseID string     `gorm:"size:64;not null;index"`
	SourceID        string     `gorm:"size:64;not null;default:'';index"`
	JobType         string     `gorm:"size:64;not null;index:idx_kb_jobs_status;index:idx_kb_jobs_claim,priority:1"`
	Status          string     `gorm:"size:64;not null;index:idx_kb_jobs_status;index:idx_kb_jobs_claim,priority:2"`
	Priority        int        `gorm:"not null;default:100;index:idx_kb_jobs_claim,priority:3"`
	Progress        string     `gorm:"column:progress_json;type:text;not null"`
	Error           string     `gorm:"type:text;not null"`
	AttemptCount    int        `gorm:"not null;default:0"`
	LeaseOwner      string     `gorm:"size:255;not null;default:'';index"`
	LeaseUntil      *time.Time `gorm:"index"`
	StartedAt       *time.Time `gorm:"index"`
	FinishedAt      *time.Time `gorm:"index"`
	CreatedAt       time.Time  `gorm:"not null;index:idx_kb_jobs_claim,priority:4"`
	UpdatedAt       time.Time  `gorm:"not null;index"`
}

func (Job) TableName() string { return "knowledge_base_jobs" }

// AuditEvent records auditable MeshX KB control-plane changes.
type AuditEvent struct {
	ID              string    `gorm:"primaryKey;size:64"`
	WorkspaceID     string    `gorm:"size:64;not null;index:idx_kb_audit_workspace_created"`
	KnowledgeBaseID string    `gorm:"size:64;not null;index"`
	ActorID         string    `gorm:"size:64;not null;index"`
	Action          string    `gorm:"size:128;not null;index"`
	ResourceType    string    `gorm:"size:64;not null;index"`
	ResourceID      string    `gorm:"size:512;not null;index"`
	Summary         string    `gorm:"type:text;not null"`
	Details         string    `gorm:"type:text;not null"`
	CreatedAt       time.Time `gorm:"not null;index:idx_kb_audit_workspace_created"`
}

func (AuditEvent) TableName() string { return "knowledge_base_audit_events" }

type KBSavedView struct {
	ID               string    `gorm:"primaryKey;size:64"`
	WorkspaceID      string    `gorm:"size:64;not null;index:idx_kb_saved_views_workspace_owner"`
	OwnerPrincipalID string    `gorm:"size:64;not null;index:idx_kb_saved_views_workspace_owner"`
	Name             string    `gorm:"size:255;not null"`
	Slug             string    `gorm:"size:255;not null;index"`
	Description      string    `gorm:"type:text;not null"`
	Filter           string    `gorm:"type:text;not null"`
	Visibility       string    `gorm:"size:64;not null;default:'private';index"`
	CreatedAt        time.Time `gorm:"not null"`
	UpdatedAt        time.Time `gorm:"not null;index"`
}

func (KBSavedView) TableName() string { return "knowledge_base_saved_views" }
