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

import (
	core "github.com/meshery/schemas/models/core"
	catalogv1alpha2 "github.com/meshery/schemas/models/v1alpha2/catalog"
	"github.com/gofrs/uuid"
)

// Defines values for MesheryFilterImportFormPayloadUploadType.
const (
	FileUpload MesheryFilterImportFormPayloadUploadType = "File Upload"
	URLUpload  MesheryFilterImportFormPayloadUploadType = "URL Upload"
)

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

// MesheryFilter Server-returned Meshery filter resource as persisted by meshery-cloud
// (`meshery_filters` table) and consumed by meshery's
// `models.MesheryFilter`. Filters carry an opaque body (`filterFile`) plus
// catalog and visibility metadata, and follow the same content-resource
// shape as designs minus the catalog engagement counters (the
// `meshery_filters` table has no `view_count` / `download_count` columns).
type MesheryFilter 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 Human-readable filter name; required, used for catalog listings.
	Name string `json:"name" yaml:"name"`

	// 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"`

	// FilterFile Raw filter source persisted as a byte array (`bytea` column
	// `filter_file`). Wire form is base64 per OpenAPI `format: byte`.
	FilterFile *[]byte `db:"filter_file" json:"filterFile,omitempty" yaml:"filterFile,omitempty"`

	// FilterResource Filter resource discriminator describing the filter body's source
	// format (e.g. WASM module identifier or external resource path).
	// Stored in the `filter_resource` text column.
	FilterResource *string                `db:"filter_resource" json:"filterResource,omitempty" yaml:"filterResource,omitempty"`
	Location       core.MapObject `json:"location,omitempty" yaml:"location,omitempty"`

	// Visibility Visibility level of a resource. Controls who can see and access it.
	// - `private`: Only the owner and explicitly shared users can access.
	// - `public`: Anyone in the organization (or anonymous, depending on resource) can discover and access.
	// - `published`: Promoted to the catalog for broad discovery beyond the owning organization.
	Visibility  core.Visibility   `json:"visibility,omitempty" yaml:"visibility,omitempty"`
	CatalogData *catalogv1alpha2.CatalogData `db:"catalog_data" json:"catalogData,omitempty" yaml:"catalogData,omitempty"`
	CreatedAt   core.Time         `db:"created_at" json:"createdAt" yaml:"createdAt"`
	UpdatedAt   core.Time         `db:"updated_at" json:"updatedAt" yaml:"updatedAt"`
}

// MesheryFilterCloneRequestBody Payload for `POST /api/content/filters/clone/{filterId}`. The
// only client-settable field is the optional name applied to the
// cloned filter; the server derives ownership and visibility from
// the request context.
type MesheryFilterCloneRequestBody struct {
	// Name Optional name to apply to the cloned filter. Defaults to a
	// server-generated derivative of the source filter's name.
	Name *string `json:"name,omitempty" yaml:"name,omitempty"`
}

// MesheryFilterDeleteRequestBody Payload for bulk deleting filters by ID.
type MesheryFilterDeleteRequestBody struct {
	// Filters Filters targeted for deletion.
	Filters []DeleteFilterModel `json:"filters" yaml:"filters"`
}

// MesheryFilterImportFormPayload Flat canonical representation of the filter import form that combines the UI-level uploadType discriminator with the union of properties from MesheryFilterPayload (filterFile, filterResource). This schema is the authoritative source for the canonical RJSF form schema at schemas/constructs/v1beta3/filter/forms/import.json. The server receives a MesheryFilterPayload; this form schema captures the superset of user-facing fields (including the UI-only uploadType discriminator) so the form schema can be validated as a subset of this canonical type.
type MesheryFilterImportFormPayload struct {
	// FilterFile Raw filter source as base64-encoded bytes. Required when uploadType is "File Upload".
	FilterFile *[]byte `json:"filterFile,omitempty" yaml:"filterFile,omitempty"`

	// FilterResource Filter resource discriminator describing the body's source format (e.g. WASM module identifier or external resource path). Required when uploadType is "URL Upload".
	FilterResource *string `json:"filterResource,omitempty" yaml:"filterResource,omitempty"`

	// Name Human-readable filter name.
	Name string `json:"name" yaml:"name"`

	// UploadType UI-level discriminator that controls which import variant the form submits. "File Upload" maps to a base64-encoded filterFile body; "URL Upload" maps to a filterResource path/URL.
	UploadType MesheryFilterImportFormPayloadUploadType `json:"uploadType" yaml:"uploadType"`
}

// MesheryFilterImportFormPayloadUploadType UI-level discriminator that controls which import variant the form submits. "File Upload" maps to a base64-encoded filterFile body; "URL Upload" maps to a filterResource path/URL.
type MesheryFilterImportFormPayloadUploadType string

// MesheryFilterPage Paginated collection of filters.
type MesheryFilterPage struct {
	// Filters Filters included on this page of results.
	Filters *[]MesheryFilter `json:"filters,omitempty" yaml:"filters,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"`
}

// MesheryFilterPayload Payload for creating or updating a filter via
// `POST /api/content/filters` or
// `PUT /api/content/filters/{filterId}`. Contains only
// client-settable fields; server-generated `createdAt` /
// `updatedAt` and the owning `userId` (which the server derives
// from the authenticated session) are intentionally excluded.
type MesheryFilterPayload struct {
	CatalogData *catalogv1alpha2.CatalogData `json:"catalogData,omitempty" yaml:"catalogData,omitempty"`

	// FilterFile Raw filter source as base64-encoded bytes (`format: byte`).
	// Optional on update — the server preserves the existing body
	// when omitted.
	FilterFile *[]byte `json:"filterFile,omitempty" yaml:"filterFile,omitempty"`

	// FilterResource Filter resource discriminator describing the body's source
	// format (e.g. WASM module identifier or external resource
	// path).
	FilterResource *string `json:"filterResource,omitempty" yaml:"filterResource,omitempty"`

	// 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,omitempty" yaml:"id,omitempty"`
	Location core.MapObject `json:"location,omitempty" yaml:"location,omitempty"`

	// Name Human-readable filter name.
	Name string `json:"name" yaml:"name"`

	// Visibility Visibility level of a resource. Controls who can see and access it.
	// - `private`: Only the owner and explicitly shared users can access.
	// - `public`: Anyone in the organization (or anonymous, depending on resource) can discover and access.
	// - `published`: Promoted to the catalog for broad discovery beyond the owning organization.
	Visibility core.Visibility `json:"visibility,omitempty" yaml:"visibility,omitempty"`
}

// MesheryFilterRequestBody Payload for upserting a filter via `POST /api/content/filters`.
// Mirrors meshery-cloud's `MesheryFilterRequestBody` and
// meshery's `MesheryFilterRequestBody` — the wrapper carries an
// optional source URL/path plus a `save` toggle and an embedded
// `filterData` payload. Wire form for the embedded payload field
// is canonical camelCase (`filterData`); legacy snake_case
// (`filter_data`) is accepted by the existing handlers for the
// deprecation window but new clients MUST emit `filterData`.
type MesheryFilterRequestBody struct {
	// Config Optional opaque configuration string passed through to the
	// underlying filter runtime. Persisted only on the local
	// meshery `MesheryFilterPayload` shape; meshery-cloud
	// currently ignores the field, but it is documented here so
	// the canonical contract is single-sourced.
	Config *string `json:"config,omitempty" yaml:"config,omitempty"`

	// FilterData Payload for creating or updating a filter via
	// `POST /api/content/filters` or
	// `PUT /api/content/filters/{filterId}`. Contains only
	// client-settable fields; server-generated `createdAt` /
	// `updatedAt` and the owning `userId` (which the server derives
	// from the authenticated session) are intentionally excluded.
	FilterData *MesheryFilterPayload `json:"filterData,omitempty" yaml:"filterData,omitempty"`
	Path       core.Text     `json:"path,omitempty" yaml:"path,omitempty"`

	// Save When true, persist the filter in addition to parsing it.
	// When false, the server returns the parsed payload without
	// committing it to the database.
	Save *bool                 `json:"save,omitempty" yaml:"save,omitempty"`
	Url  core.Endpoint `json:"url,omitempty" yaml:"url,omitempty"`
}

// FilterId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
type FilterId = 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
