// Package design 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 design

import (
	"encoding/json"
	"fmt"

	core "github.com/meshery/schemas/models/core"
	catalogv1alpha2 "github.com/meshery/schemas/models/v1alpha2/catalog"
	component "github.com/meshery/schemas/models/v1beta2/component"
	corev1beta2 "github.com/meshery/schemas/models/v1beta2/core"
	relationship "github.com/meshery/schemas/models/v1beta2/relationship"
	userV1beta "github.com/meshery/schemas/models/v1beta2/user"
	filterv1beta3 "github.com/meshery/schemas/models/v1beta3/filter"
	"github.com/oapi-codegen/runtime"
	openapi_types "github.com/oapi-codegen/runtime/types"
	"github.com/gofrs/uuid"
)

// Defines values for CatalogContentType.
const (
	CatalogContentTypeFilter  CatalogContentType = "filter"
	CatalogContentTypePattern CatalogContentType = "pattern"
)

// Defines values for CatalogRequestContentClass.
const (
	CatalogContentClassCommunity CatalogRequestContentClass = "community"
	CatalogContentClassOfficial  CatalogRequestContentClass = "official"
	CatalogContentClassProject   CatalogRequestContentClass = "project"
	CatalogContentClassVerified  CatalogRequestContentClass = "verified"
)

// Defines values for CatalogRequestStatus.
const (
	CatalogRequestStatusApproved CatalogRequestStatus = "approved"
	CatalogRequestStatusDenied   CatalogRequestStatus = "denied"
	CatalogRequestStatusPending  CatalogRequestStatus = "pending"
)

// Defines values for ContentSharePayloadContentType.
const (
	Filter  ContentSharePayloadContentType = "filter"
	Pattern ContentSharePayloadContentType = "pattern"
	View    ContentSharePayloadContentType = "view"
)

// Defines values for MesheryPatternDesignType.
const (
	MesheryPatternDesignTypeDesign             MesheryPatternDesignType = "Design"
	MesheryPatternDesignTypeDockerCompose      MesheryPatternDesignType = "Docker Compose"
	MesheryPatternDesignTypeHelmChart          MesheryPatternDesignType = "Helm Chart"
	MesheryPatternDesignTypeKubernetesManifest MesheryPatternDesignType = "Kubernetes Manifest"
)

// Defines values for MesheryPatternVisibility.
const (
	MesheryPatternVisibilityPrivate   MesheryPatternVisibility = "private"
	MesheryPatternVisibilityPublic    MesheryPatternVisibility = "public"
	MesheryPatternVisibilityPublished MesheryPatternVisibility = "published"
)

// Defines values for MesheryPatternImportFormPayloadUploadType.
const (
	FileUpload MesheryPatternImportFormPayloadUploadType = "File Upload"
	URLImport  MesheryPatternImportFormPayloadUploadType = "URL Import"
)

// Defines values for MesheryPatternPayloadDesignType.
const (
	MesheryPatternPayloadDesignTypeDesign             MesheryPatternPayloadDesignType = "Design"
	MesheryPatternPayloadDesignTypeDockerCompose      MesheryPatternPayloadDesignType = "Docker Compose"
	MesheryPatternPayloadDesignTypeHelmChart          MesheryPatternPayloadDesignType = "Helm Chart"
	MesheryPatternPayloadDesignTypeKubernetesManifest MesheryPatternPayloadDesignType = "Kubernetes Manifest"
)

// Defines values for MesheryPatternPayloadVisibility.
const (
	MesheryPatternPayloadVisibilityPrivate   MesheryPatternPayloadVisibility = "private"
	MesheryPatternPayloadVisibilityPublic    MesheryPatternPayloadVisibility = "public"
	MesheryPatternPayloadVisibilityPublished MesheryPatternPayloadVisibility = "published"
)

// DesignPreferences Design-level preferences
type DesignPreferences struct {
	// Layers Map of available layers, where keys are layer names.
	Layers map[string]interface{} `json:"layers" yaml:"layers"`
}

// CatalogContentClass defines model for CatalogContentClass.
type CatalogContentClass struct {
	// Class The class of the catalogcontentclass.
	Class *string `json:"class,omitempty" yaml:"class,omitempty"`

	// Description Description of the catalogcontentclass.
	Description          *string                `json:"description,omitempty" yaml:"description,omitempty"`
	AdditionalProperties map[string]interface{} `json:"-" yaml:"-"`
}

// CatalogContentItem defines model for CatalogContentItem.
type CatalogContentItem map[string]interface{}

// CatalogContentPage Paginated catalog content listing (designs, filters, aggregate counts).
type CatalogContentPage struct {
	// CategoryCount Category-by-count aggregates for the catalog page.
	CategoryCount *[]map[string]interface{} `json:"categoryCount,omitempty" yaml:"categoryCount,omitempty"`

	// Filters Published filters included on this page.
	Filters *[]filterv1beta3.MesheryFilter `json:"filters,omitempty" yaml:"filters,omitempty"`

	// ModelsCount Model-by-count aggregates for the catalog page.
	ModelsCount *[]map[string]interface{} `json:"modelsCount,omitempty" yaml:"modelsCount,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"`

	// Patterns Published designs included on this page.
	Patterns *[]MesheryPattern `json:"patterns,omitempty" yaml:"patterns,omitempty"`

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

// CatalogContentType Kind of catalog content a publish request refers to. Matches the
// `content_type` column of the meshery-cloud `catalog_requests`
// table.
type CatalogContentType string

// CatalogRequest Server-returned catalog publish request as persisted by
// meshery-cloud (`catalog_requests` table). Records a user's
// request to publish a design or filter to the catalog, along
// with the reviewer-visible requester identity and the request's
// approval status.
type CatalogRequest struct {
	// ContentClass Support-level classification of the content, stored in the
	// `content_class` column (a Postgres enum). Nullable — legacy
	// requests predate the column.
	ContentClass *CatalogRequestContentClass `db:"content_class" json:"contentClass" yaml:"contentClass"`

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

	// ContentName Human-readable name of the content at request time.
	ContentName string `db:"content_name" json:"contentName" yaml:"contentName"`

	// ContentType Kind of catalog content a publish request refers to. Matches the
	// `content_type` column of the meshery-cloud `catalog_requests`
	// table.
	ContentType CatalogContentType `db:"content_type" json:"contentType" yaml:"contentType"`
	CreatedAt   core.Time  `db:"created_at" json:"createdAt" yaml:"createdAt"`

	// Email Requesting user's email address at request time.
	Email openapi_types.Email `json:"email" yaml:"email"`

	// FirstName Requesting user's first name at request time.
	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 `json:"id" yaml:"id"`

	// LastName Requesting user's last name at request time.
	LastName string `db:"last_name" json:"lastName" yaml:"lastName"`

	// Status Lifecycle status of a catalog publish request. Requests are
	// created `pending`; approving or denying a request is terminal —
	// a request that is no longer pending cannot be re-approved or
	// re-denied.
	Status    CatalogRequestStatus `json:"status" yaml:"status"`
	UpdatedAt core.Time    `db:"updated_at" json:"updatedAt" yaml:"updatedAt"`

	// User Represents a user
	User *userV1beta.User `db:"-" json:"user,omitempty" yaml:"user,omitempty"`
}

// CatalogRequestContentClass Support-level classification of the content, stored in the
// `content_class` column (a Postgres enum). Nullable — legacy
// requests predate the column.
type CatalogRequestContentClass string

// CatalogRequestStatus Lifecycle status of a catalog publish request. Requests are
// created `pending`; approving or denying a request is terminal —
// a request that is no longer pending cannot be re-approved or
// re-denied.
type CatalogRequestStatus string

// CatalogRequestsPage Paginated catalog-request listing (pending publish approvals).
type CatalogRequestsPage struct {
	// CatalogRequests Catalog requests included on this page.
	CatalogRequests *[]CatalogRequest `json:"catalogRequests,omitempty" yaml:"catalogRequests,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"`
}

// ContentSharePayload Payload for sharing a piece of content (design, filter, or view) with one
// or more recipients by email. This schema backs both
// `POST /api/content/design/share` and `POST /api/content/view/share`; the
// server dispatches on `contentType` to decide which entity to mutate.
type ContentSharePayload struct {
	// ContentId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	ContentId core.Uuid `json:"contentId" yaml:"contentId"`

	// ContentType The kind of content being shared. Must match the entity the handler
	// expects — `pattern` and `filter` are valid on the design share
	// endpoint; `view` is valid on the view share endpoint.
	ContentType ContentSharePayloadContentType `json:"contentType" yaml:"contentType"`

	// Emails Email addresses of the recipients to share this content with.
	Emails []openapi_types.Email `json:"emails" yaml:"emails"`

	// Share When true, flip visibility to public and send invitation emails to
	// the recipients. When false, revert visibility to private.
	Share bool `json:"share" yaml:"share"`
}

// ContentSharePayloadContentType The kind of content being shared. Must match the entity the handler
// expects — `pattern` and `filter` are valid on the design share
// endpoint; `view` is valid on the view share endpoint.
type ContentSharePayloadContentType string

// DeletePatternModel Reference to a design for bulk deletion by ID.
type DeletePatternModel struct {
	ID   core.Id   `json:"id,omitempty" yaml:"id,omitempty"`
	Name core.Text `json:"name,omitempty" yaml:"name,omitempty"`
}

// MesheryPattern Server-returned design (pattern) resource as persisted by meshery-cloud.
type MesheryPattern struct {
	CatalogData *catalogv1alpha2.CatalogData `json:"catalogData,omitempty" yaml:"catalogData,omitempty"`

	// CloneCount Server-aggregated count of times this design has been cloned from the catalog. Server-managed and ignored on writes.
	CloneCount *int              `db:"clone_count" json:"cloneCount,omitempty" yaml:"cloneCount,omitempty"`
	CreatedAt  core.Time `db:"created_at" json:"createdAt,omitempty" yaml:"createdAt,omitempty"`

	// DeploymentCount Server-aggregated count of deployments originated from this design. Server-managed and ignored on writes.
	DeploymentCount *int `db:"deployment_count" json:"deploymentCount,omitempty" yaml:"deploymentCount,omitempty"`

	// DesignType Discriminator identifying the source format of the design body, persisted in the meshery_patterns table's `source_type` column (nullable; null for legacy rows imported before the column was introduced). For catalog listings the server may also project this field from the attached catalog metadata. Use this field to branch rendering between native Meshery designs and imported Helm charts, Kubernetes manifests, and Docker Compose files.
	DesignType *MesheryPatternDesignType `db:"source_type" json:"designType" yaml:"designType"`

	// DownloadCount Server-aggregated count of downloads of this design from the catalog. Server-managed and ignored on writes.
	DownloadCount *int                   `db:"download_count" json:"downloadCount,omitempty" yaml:"downloadCount,omitempty"`
	ID            core.Id        `json:"id,omitempty" yaml:"id,omitempty"`
	Location      core.MapObject `json:"location,omitempty" yaml:"location,omitempty"`
	Name          core.Text      `json:"name,omitempty" yaml:"name,omitempty"`

	// PatternFile Raw design body as it is persisted in the meshery_patterns table's `pattern_file` column. The wire form is the YAML/JSON string the server stores verbatim; consumers that need the structured form transcode at the boundary by parsing the string into a PatternFile (see #/components/schemas/PatternFile) and marshalling it back when they write. Keeping the wire shape as a string mirrors the column's actual representation and avoids forcing every consumer through the structured-vs- string union that the previous *PatternFile typing implied.
	PatternFile *string `db:"pattern_file" json:"patternFile,omitempty" yaml:"patternFile,omitempty"`

	// ShareCount Server-aggregated count of share events for this design. Server-managed and ignored on writes.
	ShareCount *int `db:"share_count" json:"shareCount,omitempty" yaml:"shareCount,omitempty"`

	// SourceContent Raw bytes of the imported source artifact (Helm chart tarball, Kubernetes manifest, Docker Compose file, etc.) preserved in the meshery_patterns table's `source_content` column for non-Meshery-Design imports. Empty / null for native Meshery designs. Server-managed: populated by the import and upload handlers and scrubbed to null on most read responses, so clients should treat this as opaque base64-encoded bytes when it does appear on the wire.
	SourceContent *[]byte           `db:"source_content" json:"sourceContent,omitempty" yaml:"sourceContent,omitempty"`
	UpdatedAt     core.Time `db:"updated_at" json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`

	// User Represents a user
	User   *userV1beta.User `db:"-" json:"user,omitempty" yaml:"user,omitempty"`
	UserId core.Id    `db:"owner" json:"userId,omitempty" yaml:"userId,omitempty"`

	// ViewCount Server-aggregated count of views on this design in the catalog. Present on list/catalog responses; server-managed and ignored on writes.
	ViewCount *int `db:"view_count" json:"viewCount,omitempty" yaml:"viewCount,omitempty"`

	// Visibility Visibility scope of the design — controls whether non-owners may read or list it. `private` is owner-only, `public` is readable by anyone in the org, and `published` is visible in the catalog.
	Visibility *MesheryPatternVisibility `db:"visibility" json:"visibility,omitempty" yaml:"visibility,omitempty"`
}

// MesheryPatternDesignType Discriminator identifying the source format of the design body, persisted in the meshery_patterns table's `source_type` column (nullable; null for legacy rows imported before the column was introduced). For catalog listings the server may also project this field from the attached catalog metadata. Use this field to branch rendering between native Meshery designs and imported Helm charts, Kubernetes manifests, and Docker Compose files.
type MesheryPatternDesignType string

// MesheryPatternVisibility Visibility scope of the design — controls whether non-owners may read or list it. `private` is owner-only, `public` is readable by anyone in the org, and `published` is visible in the catalog.
type MesheryPatternVisibility string

// MesheryPatternDeleteRequestBody Payload for bulk deleting designs by ID.
type MesheryPatternDeleteRequestBody struct {
	// Patterns Designs targeted for deletion.
	Patterns *[]DeletePatternModel `json:"patterns,omitempty" yaml:"patterns,omitempty"`
}

// MesheryPatternImportFilePayload Upload a design file from the local system. Both `file` and `fileName` are required; the server uses the file name to identify the file type (Kubernetes Manifest, Helm Chart, Docker Compose, or Meshery Design).
type MesheryPatternImportFilePayload struct {
	// File Base64-encoded file bytes. Supported formats: Kubernetes Manifests, Helm Charts, Docker Compose, and Meshery Designs. See [Import Designs Documentation](https://docs.meshery.io/guides/configuration-management/importing-designs#import-designs-using-meshery-ui) for details.
	File []byte `json:"file" yaml:"file"`

	// FileName The name of the pattern file being imported. Include the extension (e.g. `design.yaml`), as the server uses it to identify the file type.
	FileName string `json:"fileName" yaml:"fileName"`

	// Name Provide a name for your design. This name will help you identify the design later. You can also change the name of your design after importing it.
	Name *string `json:"name,omitempty" yaml:"name,omitempty"`
}

// MesheryPatternImportFormPayload Flat canonical representation of the design import form that combines the discriminator field with the union of properties from MesheryPatternImportFilePayload and MesheryPatternImportURLPayload. This schema is the authoritative source for the canonical RJSF form schema at schemas/constructs/v1beta3/design/forms/import.json. The server receives either a File-import payload or a URL-import payload (as defined by MesheryPatternImportRequestBody); this form schema captures the superset of user-facing fields so the form schema can be validated as a subset of this canonical type.
type MesheryPatternImportFormPayload struct {
	// File Base64-encoded file bytes. Supported formats: Kubernetes Manifests, Helm Charts, Docker Compose, and Meshery Designs.
	File *[]byte `json:"file,omitempty" yaml:"file,omitempty"`

	// Name Provide a name for your design. This name will help you identify the design later. You can also change the name of your design after importing it.
	Name *string `json:"name,omitempty" yaml:"name,omitempty"`

	// UploadType UI-level discriminator that controls which import variant the form submits. The client maps "File Upload" to MesheryPatternImportFilePayload and "URL Import" to MesheryPatternImportURLPayload before calling the API.
	UploadType *MesheryPatternImportFormPayloadUploadType `json:"uploadType,omitempty" yaml:"uploadType,omitempty"`

	// Url A direct URL to a single file. Ensure the resource is in a supported format: Kubernetes Manifest, Helm Chart, Docker Compose, or Meshery Design.
	Url *string `json:"url,omitempty" yaml:"url,omitempty"`
}

// MesheryPatternImportFormPayloadUploadType UI-level discriminator that controls which import variant the form submits. The client maps "File Upload" to MesheryPatternImportFilePayload and "URL Import" to MesheryPatternImportURLPayload before calling the API.
type MesheryPatternImportFormPayloadUploadType string

// MesheryPatternImportRequestBody Body for POST /api/pattern/import. Consumed by the server as application/json. Exactly one of two variants must be supplied: a File Import carrying base64-encoded bytes plus a file name, or a URL Import naming a remote location the server will fetch. Sending both variants at once, or neither, is rejected with 400.
type MesheryPatternImportRequestBody struct {
	union json.RawMessage
}

// MesheryPatternImportURLPayload Import a design by URL. The server will fetch the resource and derive the file type from the response.
type MesheryPatternImportURLPayload struct {
	// Name Provide a name for your design. This name will help you identify the design later. You can also change the name of your design after importing it.
	Name *string `json:"name,omitempty" yaml:"name,omitempty"`

	// Url A direct URL to a single file, for example: https://raw.github.com/your-design-file.yaml. Ensure the resource is in a supported format: Kubernetes Manifest, Helm Chart, Docker Compose, or Meshery Design. See [Import Designs Documentation](https://docs.meshery.io/guides/configuration-management/importing-designs#import-designs-using-meshery-ui) for details.
	Url string `json:"url" yaml:"url"`
}

// MesheryPatternPage Paginated collection of designs.
type MesheryPatternPage struct {
	// 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"`

	// Patterns Designs included on this page of results.
	Patterns *[]MesheryPattern `json:"patterns,omitempty" yaml:"patterns,omitempty"`

	// ResultType Optional discriminator describing which collection the page represents.
	ResultType *string `json:"resultType,omitempty" yaml:"resultType,omitempty"`

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

// MesheryPatternPayload Client-settable subset of the design (pattern) entity used as the body of the inner `patternData` envelope on POST /api/content/patterns. Server-generated fields (createdAt, updatedAt, viewCount, downloadCount, cloneCount, deploymentCount, shareCount, the joined `user` object, and the imported-source `sourceContent` blob) are deliberately excluded — the server ignores them on writes and re-projects them on the response.
type MesheryPatternPayload struct {
	CatalogData *catalogv1alpha2.CatalogData `json:"catalogData,omitempty" yaml:"catalogData,omitempty"`

	// DesignType Discriminator identifying the source format of the design body, stored in the `source_type` column. Optional on create (the server defaults missing values to `Design`).
	DesignType *MesheryPatternPayloadDesignType `json:"designType" yaml:"designType"`
	ID         core.Id                  `json:"id,omitempty" yaml:"id,omitempty"`
	Location   core.MapObject           `json:"location,omitempty" yaml:"location,omitempty"`

	// Name Human-readable design name.
	Name *string `json:"name,omitempty" yaml:"name,omitempty"`

	// PatternFile Raw design body to persist into the `pattern_file` column. See MesheryPattern.patternFile for the transcode boundary note that applies on both writes and reads.
	PatternFile *string         `json:"patternFile,omitempty" yaml:"patternFile,omitempty"`
	UserId      core.Id `json:"userId,omitempty" yaml:"userId,omitempty"`

	// Visibility Visibility scope of the design.
	Visibility *MesheryPatternPayloadVisibility `json:"visibility,omitempty" yaml:"visibility,omitempty"`
}

// MesheryPatternPayloadDesignType Discriminator identifying the source format of the design body, stored in the `source_type` column. Optional on create (the server defaults missing values to `Design`).
type MesheryPatternPayloadDesignType string

// MesheryPatternPayloadVisibility Visibility scope of the design.
type MesheryPatternPayloadVisibility string

// MesheryPatternRequestBody Payload for upserting a design via POST /api/content/patterns.
type MesheryPatternRequestBody struct {
	// Name Human-readable design name.
	Name *string           `json:"name,omitempty" yaml:"name,omitempty"`
	Path core.Text `json:"path,omitempty" yaml:"path,omitempty"`

	// PatternData Client-settable subset of the design (pattern) entity used as the body of the inner `patternData` envelope on POST /api/content/patterns. Server-generated fields (createdAt, updatedAt, viewCount, downloadCount, cloneCount, deploymentCount, shareCount, the joined `user` object, and the imported-source `sourceContent` blob) are deliberately excluded — the server ignores them on writes and re-projects them on the response.
	PatternData *MesheryPatternPayload `json:"patternData,omitempty" yaml:"patternData,omitempty"`

	// Save When true, persist the design in addition to parsing it.
	Save *bool                 `json:"save,omitempty" yaml:"save,omitempty"`
	Url  core.Endpoint `json:"url,omitempty" yaml:"url,omitempty"`
}

// PatternFile Designs are your primary tool for collaborative authorship of your infrastructure, workflow, and processes.
type PatternFile 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 `json:"id" yaml:"id"`

	// Name Name of the design; a descriptive, but concise title for the design document.
	Name string `json:"name" yaml:"name"`

	// SchemaVersion API version of the object, optionally prefixed with an API group (e.g. "group.example.io/v1beta1" or bare "v1beta1").
	SchemaVersion core.VersionString `json:"schemaVersion" yaml:"schemaVersion"`

	// Version A valid semantic version string between 5 and 100 characters. The pattern allows for a major.minor.patch version followed by an optional pre-release tag like '-alpha' or '-beta.2' and an optional build metadata tag like '+build.1'.
	Version core.SemverString `json:"version" yaml:"version"`

	// Metadata Additional metadata associated with this resource.
	Metadata *PatternFile_Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`

	// Components A list of one or more component declarations.
	Components []*component.ComponentDefinition `json:"components" yaml:"components"`

	// Preferences Design-level preferences
	Preferences *DesignPreferences `json:"preferences,omitempty" yaml:"preferences,omitempty"`

	// Relationships List of relationships between components
	Relationships []*relationship.RelationshipDefinition `json:"relationships" yaml:"relationships"`
}

// PatternFile_Metadata Additional metadata associated with this resource.
type PatternFile_Metadata struct {
	// ResolvedAliases Map of resolved aliases present in the design
	ResolvedAliases      *map[string]corev1beta2.ResolvedAlias `json:"resolvedAliases,omitempty" yaml:"resolvedAliases,omitempty"`
	AdditionalProperties map[string]interface{}                `json:"-" yaml:"-"`
}

// ResourceAccessActorsResponse defines model for ResourceAccessActorsResponse.
type ResourceAccessActorsResponse struct {
	// Users The users of the resourceaccessactorsresponse.
	Users *[]map[string]interface{} `json:"users,omitempty" yaml:"users,omitempty"`
}

// ResourceAccessMapping defines model for ResourceAccessMapping.
type ResourceAccessMapping map[string]interface{}

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

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

// OrgIdQuery defines model for orgIdQuery.
type OrgIdQuery = uuid.UUID

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

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

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

// CatalogContentPayload defines model for catalogContentPayload.
type CatalogContentPayload map[string]interface{}

// ResourceSharePayload defines model for resourceSharePayload.
type ResourceSharePayload map[string]interface{}

// Getter for additional properties for CatalogContentClass. Returns the specified
// element and whether it was found
func (a CatalogContentClass) Get(fieldName string) (value interface{}, found bool) {
	if a.AdditionalProperties != nil {
		value, found = a.AdditionalProperties[fieldName]
	}
	return
}

// Setter for additional properties for CatalogContentClass
func (a *CatalogContentClass) Set(fieldName string, value interface{}) {
	if a.AdditionalProperties == nil {
		a.AdditionalProperties = make(map[string]interface{})
	}
	a.AdditionalProperties[fieldName] = value
}

// Override default JSON handling for CatalogContentClass to handle AdditionalProperties
func (a *CatalogContentClass) UnmarshalJSON(b []byte) error {
	object := make(map[string]json.RawMessage)
	err := json.Unmarshal(b, &object)
	if err != nil {
		return err
	}

	if raw, found := object["class"]; found {
		err = json.Unmarshal(raw, &a.Class)
		if err != nil {
			return fmt.Errorf("error reading 'class': %w", err)
		}
		delete(object, "class")
	}

	if raw, found := object["description"]; found {
		err = json.Unmarshal(raw, &a.Description)
		if err != nil {
			return fmt.Errorf("error reading 'description': %w", err)
		}
		delete(object, "description")
	}

	if len(object) != 0 {
		a.AdditionalProperties = make(map[string]interface{})
		for fieldName, fieldBuf := range object {
			var fieldVal interface{}
			err := json.Unmarshal(fieldBuf, &fieldVal)
			if err != nil {
				return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err)
			}
			a.AdditionalProperties[fieldName] = fieldVal
		}
	}
	return nil
}

// Override default JSON handling for CatalogContentClass to handle AdditionalProperties
func (a CatalogContentClass) MarshalJSON() ([]byte, error) {
	var err error
	object := make(map[string]json.RawMessage)

	if a.Class != nil {
		object["class"], err = json.Marshal(a.Class)
		if err != nil {
			return nil, fmt.Errorf("error marshaling 'class': %w", err)
		}
	}

	if a.Description != nil {
		object["description"], err = json.Marshal(a.Description)
		if err != nil {
			return nil, fmt.Errorf("error marshaling 'description': %w", err)
		}
	}

	for fieldName, field := range a.AdditionalProperties {
		object[fieldName], err = json.Marshal(field)
		if err != nil {
			return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err)
		}
	}
	return json.Marshal(object)
}

// Getter for additional properties for PatternFile_Metadata. Returns the specified
// element and whether it was found
func (a PatternFile_Metadata) Get(fieldName string) (value interface{}, found bool) {
	if a.AdditionalProperties != nil {
		value, found = a.AdditionalProperties[fieldName]
	}
	return
}

// Setter for additional properties for PatternFile_Metadata
func (a *PatternFile_Metadata) Set(fieldName string, value interface{}) {
	if a.AdditionalProperties == nil {
		a.AdditionalProperties = make(map[string]interface{})
	}
	a.AdditionalProperties[fieldName] = value
}

// Override default JSON handling for PatternFile_Metadata to handle AdditionalProperties
func (a *PatternFile_Metadata) UnmarshalJSON(b []byte) error {
	object := make(map[string]json.RawMessage)
	err := json.Unmarshal(b, &object)
	if err != nil {
		return err
	}

	if raw, found := object["resolvedAliases"]; found {
		err = json.Unmarshal(raw, &a.ResolvedAliases)
		if err != nil {
			return fmt.Errorf("error reading 'resolvedAliases': %w", err)
		}
		delete(object, "resolvedAliases")
	}

	if len(object) != 0 {
		a.AdditionalProperties = make(map[string]interface{})
		for fieldName, fieldBuf := range object {
			var fieldVal interface{}
			err := json.Unmarshal(fieldBuf, &fieldVal)
			if err != nil {
				return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err)
			}
			a.AdditionalProperties[fieldName] = fieldVal
		}
	}
	return nil
}

// Override default JSON handling for PatternFile_Metadata to handle AdditionalProperties
func (a PatternFile_Metadata) MarshalJSON() ([]byte, error) {
	var err error
	object := make(map[string]json.RawMessage)

	if a.ResolvedAliases != nil {
		object["resolvedAliases"], err = json.Marshal(a.ResolvedAliases)
		if err != nil {
			return nil, fmt.Errorf("error marshaling 'resolvedAliases': %w", err)
		}
	}

	for fieldName, field := range a.AdditionalProperties {
		object[fieldName], err = json.Marshal(field)
		if err != nil {
			return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err)
		}
	}
	return json.Marshal(object)
}

// AsMesheryPatternImportFilePayload returns the union data inside the MesheryPatternImportRequestBody as a MesheryPatternImportFilePayload
func (t MesheryPatternImportRequestBody) AsMesheryPatternImportFilePayload() (MesheryPatternImportFilePayload, error) {
	var body MesheryPatternImportFilePayload
	err := json.Unmarshal(t.union, &body)
	return body, err
}

// FromMesheryPatternImportFilePayload overwrites any union data inside the MesheryPatternImportRequestBody as the provided MesheryPatternImportFilePayload
func (t *MesheryPatternImportRequestBody) FromMesheryPatternImportFilePayload(v MesheryPatternImportFilePayload) error {
	b, err := json.Marshal(v)
	t.union = b
	return err
}

// MergeMesheryPatternImportFilePayload performs a merge with any union data inside the MesheryPatternImportRequestBody, using the provided MesheryPatternImportFilePayload
func (t *MesheryPatternImportRequestBody) MergeMesheryPatternImportFilePayload(v MesheryPatternImportFilePayload) error {
	b, err := json.Marshal(v)
	if err != nil {
		return err
	}

	merged, err := runtime.JSONMerge(t.union, b)
	t.union = merged
	return err
}

// AsMesheryPatternImportURLPayload returns the union data inside the MesheryPatternImportRequestBody as a MesheryPatternImportURLPayload
func (t MesheryPatternImportRequestBody) AsMesheryPatternImportURLPayload() (MesheryPatternImportURLPayload, error) {
	var body MesheryPatternImportURLPayload
	err := json.Unmarshal(t.union, &body)
	return body, err
}

// FromMesheryPatternImportURLPayload overwrites any union data inside the MesheryPatternImportRequestBody as the provided MesheryPatternImportURLPayload
func (t *MesheryPatternImportRequestBody) FromMesheryPatternImportURLPayload(v MesheryPatternImportURLPayload) error {
	b, err := json.Marshal(v)
	t.union = b
	return err
}

// MergeMesheryPatternImportURLPayload performs a merge with any union data inside the MesheryPatternImportRequestBody, using the provided MesheryPatternImportURLPayload
func (t *MesheryPatternImportRequestBody) MergeMesheryPatternImportURLPayload(v MesheryPatternImportURLPayload) error {
	b, err := json.Marshal(v)
	if err != nil {
		return err
	}

	merged, err := runtime.JSONMerge(t.union, b)
	t.union = merged
	return err
}

func (t MesheryPatternImportRequestBody) MarshalJSON() ([]byte, error) {
	b, err := t.union.MarshalJSON()
	return b, err
}

func (t *MesheryPatternImportRequestBody) UnmarshalJSON(b []byte) error {
	err := t.union.UnmarshalJSON(b)
	return err
}
