'use strict';

var zod = require('zod');

// src/cloud/marketplace.zod.ts
var PublisherVerificationSchema = zod.z.enum([
  "unverified",
  // Not yet verified
  "pending",
  // Verification in progress
  "verified",
  // Identity verified by platform
  "trusted",
  // Trusted publisher (track record of quality)
  "partner"
  // Official platform partner
]).describe("Publisher verification status");
var PublisherSchema = zod.z.object({
  /** Publisher unique identifier */
  id: zod.z.string().describe("Publisher ID"),
  /** Display name */
  name: zod.z.string().describe("Publisher display name"),
  /** Publisher type */
  type: zod.z.enum(["individual", "organization"]).describe("Publisher type"),
  /** Verification status */
  verification: PublisherVerificationSchema.default("unverified").describe("Publisher verification status"),
  /** Contact email */
  email: zod.z.string().email().optional().describe("Contact email"),
  /** Website URL */
  website: zod.z.string().url().optional().describe("Publisher website"),
  /** Organization logo URL */
  logoUrl: zod.z.string().url().optional().describe("Publisher logo URL"),
  /** Short description/bio */
  description: zod.z.string().optional().describe("Publisher description"),
  /** Registration date */
  registeredAt: zod.z.string().datetime().optional().describe("Publisher registration timestamp")
}).describe("Developer or organization that publishes packages");
var ArtifactReferenceSchema = zod.z.object({
  /** Artifact download URL */
  url: zod.z.string().url().describe("Artifact download URL"),
  /** SHA256 integrity checksum */
  sha256: zod.z.string().regex(/^[a-f0-9]{64}$/).describe("SHA256 checksum"),
  /** File size in bytes */
  size: zod.z.number().int().positive().describe("Artifact size in bytes"),
  /** Artifact format */
  format: zod.z.enum(["tgz", "zip"]).default("tgz").describe("Artifact format"),
  /** Upload timestamp */
  uploadedAt: zod.z.string().datetime().describe("Upload timestamp")
}).describe("Reference to a downloadable package artifact");
var ArtifactDownloadResponseSchema = zod.z.object({
  /** Pre-signed or direct download URL */
  downloadUrl: zod.z.string().url().describe("Artifact download URL (may be pre-signed)"),
  /** SHA256 checksum for download verification */
  sha256: zod.z.string().regex(/^[a-f0-9]{64}$/).describe("SHA256 checksum for verification"),
  /** File size in bytes */
  size: zod.z.number().int().positive().describe("Artifact size in bytes"),
  /** Artifact format */
  format: zod.z.enum(["tgz", "zip"]).describe("Artifact format"),
  /** URL expiration time (for pre-signed URLs) */
  expiresAt: zod.z.string().datetime().optional().describe("URL expiration timestamp for pre-signed URLs")
}).describe("Artifact download response with integrity metadata");
var MarketplaceCategorySchema = zod.z.enum([
  "crm",
  // Customer Relationship Management
  "erp",
  // Enterprise Resource Planning
  "hr",
  // Human Resources
  "finance",
  // Finance & Accounting
  "project",
  // Project Management
  "collaboration",
  // Collaboration & Communication
  "analytics",
  // Analytics & Reporting
  "integration",
  // Integrations & Connectors
  "automation",
  // Automation & Workflows
  "ai",
  // AI & Machine Learning
  "security",
  // Security & Compliance
  "developer-tools",
  // Developer Tools
  "ui-theme",
  // UI Themes & Appearance
  "storage",
  // Storage & Drivers
  "other"
  // Other / Uncategorized
]).describe("Marketplace package category");
var ListingStatusSchema = zod.z.enum([
  "draft",
  // Not yet submitted
  "submitted",
  // Submitted for review
  "in-review",
  // Under review
  "approved",
  // Approved, ready to publish
  "published",
  // Live on marketplace
  "rejected",
  // Review rejected
  "suspended",
  // Suspended by platform (policy violation)
  "deprecated",
  // Deprecated by publisher
  "unlisted"
  // Available by direct link only
]).describe("Marketplace listing status");
var PricingModelSchema = zod.z.enum([
  "free",
  // Free to install
  "freemium",
  // Free with paid premium features
  "paid",
  // Requires purchase
  "subscription",
  // Recurring subscription
  "usage-based",
  // Pay per usage
  "contact-sales"
  // Enterprise pricing, contact for quote
]).describe("Package pricing model");
var MarketplaceListingSchema = zod.z.object({
  /** Listing ID (matches package ID) */
  id: zod.z.string().describe("Listing ID (matches package manifest ID)"),
  /** Package ID (reverse domain notation) */
  packageId: zod.z.string().describe("Package identifier"),
  /** Publisher information */
  publisherId: zod.z.string().describe("Publisher ID"),
  /** Current listing status */
  status: ListingStatusSchema.default("draft").describe("Publication state: draft, published, under-review, suspended, deprecated, or unlisted"),
  /** Display name */
  name: zod.z.string().describe("Display name"),
  /** Tagline (short description for cards/search results) */
  tagline: zod.z.string().max(120).optional().describe("Short tagline (max 120 chars)"),
  /** Full description (supports Markdown) */
  description: zod.z.string().optional().describe("Full description (Markdown)"),
  /** Category */
  category: MarketplaceCategorySchema.describe("Package category"),
  /** Additional tags for search discovery */
  tags: zod.z.array(zod.z.string()).optional().describe("Search tags"),
  /** Icon/logo URL */
  iconUrl: zod.z.string().url().optional().describe("Package icon URL"),
  /** Screenshot URLs */
  screenshots: zod.z.array(zod.z.object({
    url: zod.z.string().url(),
    caption: zod.z.string().optional()
  })).optional().describe("Screenshots"),
  /** Documentation URL */
  documentationUrl: zod.z.string().url().optional().describe("Documentation URL"),
  /** Support URL */
  supportUrl: zod.z.string().url().optional().describe("Support URL"),
  /** Source repository URL (if open source) */
  repositoryUrl: zod.z.string().url().optional().describe("Source repository URL"),
  /** Pricing model */
  pricing: PricingModelSchema.default("free").describe("Pricing model"),
  /** Price in cents (if paid) */
  priceInCents: zod.z.number().int().min(0).optional().describe("Price in cents (e.g. 999 = $9.99)"),
  /** Latest published version */
  latestVersion: zod.z.string().describe("Latest published version"),
  /** Minimum platform version required */
  minPlatformVersion: zod.z.string().optional().describe("Minimum ObjectStack platform version"),
  /** Available versions for installation */
  versions: zod.z.array(zod.z.object({
    version: zod.z.string().describe("Version string"),
    releaseDate: zod.z.string().datetime().describe("Release date"),
    releaseNotes: zod.z.string().optional().describe("Release notes"),
    minPlatformVersion: zod.z.string().optional().describe("Minimum platform version"),
    deprecated: zod.z.boolean().default(false).describe("Whether this version is deprecated"),
    /** Artifact reference for this version */
    artifact: ArtifactReferenceSchema.optional().describe("Downloadable artifact for this version")
  })).optional().describe("Published versions"),
  /** Aggregate statistics */
  stats: zod.z.object({
    totalInstalls: zod.z.number().int().min(0).default(0).describe("Total installs"),
    activeInstalls: zod.z.number().int().min(0).default(0).describe("Active installs"),
    averageRating: zod.z.number().min(0).max(5).optional().describe("Average user rating (0-5)"),
    totalRatings: zod.z.number().int().min(0).default(0).describe("Total ratings count"),
    totalReviews: zod.z.number().int().min(0).default(0).describe("Total reviews count")
  }).optional().describe("Aggregate marketplace statistics"),
  /** First published date */
  publishedAt: zod.z.string().datetime().optional().describe("First published timestamp"),
  /** Last updated date */
  updatedAt: zod.z.string().datetime().optional().describe("Last updated timestamp")
}).describe("Public-facing package listing on the marketplace");
var PackageSubmissionSchema = zod.z.object({
  /** Submission ID */
  id: zod.z.string().describe("Submission ID"),
  /** Package ID */
  packageId: zod.z.string().describe("Package identifier"),
  /** Version being submitted */
  version: zod.z.string().describe("Version being submitted"),
  /** Publisher ID */
  publisherId: zod.z.string().describe("Publisher submitting"),
  /** Submission status */
  status: zod.z.enum([
    "pending",
    // Awaiting review
    "scanning",
    // Automated scan in progress
    "in-review",
    // Under manual review
    "changes-requested",
    // Reviewer requests changes
    "approved",
    // Approved for publishing
    "rejected"
    // Rejected
  ]).default("pending").describe("Review status"),
  /**
   * Package artifact URL or reference.
   * Points to the built package bundle for review.
   */
  artifactUrl: zod.z.string().describe("Package artifact URL for review"),
  /** Release notes for this version */
  releaseNotes: zod.z.string().optional().describe("Release notes for this version"),
  /** Whether this is the first submission (new listing) vs version update */
  isNewListing: zod.z.boolean().default(false).describe("Whether this is a new listing submission"),
  /** Automated scan results */
  scanResults: zod.z.object({
    /** Whether automated scan passed */
    passed: zod.z.boolean(),
    /** Security scan score (0-100) */
    securityScore: zod.z.number().min(0).max(100).optional(),
    /** Compatibility check passed */
    compatibilityCheck: zod.z.boolean().optional(),
    /** Issues found during scan */
    issues: zod.z.array(zod.z.object({
      severity: zod.z.enum(["critical", "high", "medium", "low", "info"]),
      message: zod.z.string(),
      file: zod.z.string().optional(),
      line: zod.z.number().optional()
    })).optional()
  }).optional().describe("Automated scan results"),
  /** Reviewer notes (from platform reviewer) */
  reviewerNotes: zod.z.string().optional().describe("Notes from the platform reviewer"),
  /** Submitted timestamp */
  submittedAt: zod.z.string().datetime().optional().describe("Submission timestamp"),
  /** Review completed timestamp */
  reviewedAt: zod.z.string().datetime().optional().describe("Review completion timestamp")
}).describe("Developer submission of a package version for review");
var MarketplaceSearchRequestSchema = zod.z.object({
  /** Search query string */
  query: zod.z.string().optional().describe("Full-text search query"),
  /** Filter by category */
  category: MarketplaceCategorySchema.optional().describe("Filter by category"),
  /** Filter by tags */
  tags: zod.z.array(zod.z.string()).optional().describe("Filter by tags"),
  /** Filter by pricing model */
  pricing: PricingModelSchema.optional().describe("Filter by pricing model"),
  /** Filter by publisher verification level */
  publisherVerification: PublisherVerificationSchema.optional().describe("Filter by publisher verification level"),
  /** Sort by */
  sortBy: zod.z.enum([
    "relevance",
    // Best match (default for search)
    "popularity",
    // Most installs
    "rating",
    // Highest rated
    "newest",
    // Most recently published
    "updated",
    // Most recently updated
    "name"
    // Alphabetical
  ]).default("relevance").describe("Sort field"),
  /** Sort direction */
  sortDirection: zod.z.enum(["asc", "desc"]).default("desc").describe("Sort direction"),
  /** Pagination: page number */
  page: zod.z.number().int().min(1).default(1).describe("Page number"),
  /** Pagination: items per page */
  pageSize: zod.z.number().int().min(1).max(100).default(20).describe("Items per page"),
  /** Filter by minimum platform version compatibility */
  platformVersion: zod.z.string().optional().describe("Filter by platform version compatibility")
}).describe("Marketplace search request");
var MarketplaceSearchResponseSchema = zod.z.object({
  /** Search results */
  items: zod.z.array(MarketplaceListingSchema).describe("Search result listings"),
  /** Total count (for pagination) */
  total: zod.z.number().int().min(0).describe("Total matching results"),
  /** Current page */
  page: zod.z.number().int().min(1).describe("Current page number"),
  /** Items per page */
  pageSize: zod.z.number().int().min(1).describe("Items per page"),
  /** Facets for filtering */
  facets: zod.z.object({
    categories: zod.z.array(zod.z.object({
      category: MarketplaceCategorySchema,
      count: zod.z.number().int().min(0)
    })).optional(),
    pricing: zod.z.array(zod.z.object({
      model: PricingModelSchema,
      count: zod.z.number().int().min(0)
    })).optional()
  }).optional().describe("Aggregation facets for refining search")
}).describe("Marketplace search response");
var MarketplaceInstallRequestSchema = zod.z.object({
  /** Listing ID to install */
  listingId: zod.z.string().describe("Marketplace listing ID"),
  /** Specific version to install (defaults to latest) */
  version: zod.z.string().optional().describe("Version to install"),
  /** License key (for paid packages) */
  licenseKey: zod.z.string().optional().describe("License key for paid packages"),
  /** User-provided settings at install time */
  settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("User-provided settings at install time"),
  /** Whether to enable immediately after install */
  enableOnInstall: zod.z.boolean().default(true).describe("Whether to enable immediately after install"),
  /** Artifact reference (resolved from listing version, or provided directly) */
  artifactRef: ArtifactReferenceSchema.optional().describe("Artifact reference for direct installation"),
  /** Tenant ID */
  tenantId: zod.z.string().optional().describe("Tenant identifier")
}).describe("Install from marketplace request");
var MarketplaceInstallResponseSchema = zod.z.object({
  /** Whether installation was successful */
  success: zod.z.boolean().describe("Whether installation succeeded"),
  /** Installed package ID */
  packageId: zod.z.string().optional().describe("Installed package identifier"),
  /** Installed version */
  version: zod.z.string().optional().describe("Installed version"),
  /** Human-readable message */
  message: zod.z.string().optional().describe("Installation status message")
}).describe("Install from marketplace response");
var PublisherProfileSchema = zod.z.object({
  /** Organization ID (references Identity.Organization.id) */
  organizationId: zod.z.string().describe("Identity Organization ID"),
  /** Publisher ID (marketplace-assigned identifier) */
  publisherId: zod.z.string().describe("Marketplace publisher ID"),
  /** Verification level (marketplace trust tier) */
  verification: PublisherVerificationSchema.default("unverified"),
  /** Accepted developer program agreement version */
  agreementVersion: zod.z.string().optional().describe("Accepted developer agreement version"),
  /** Publisher-specific website (may differ from org) */
  website: zod.z.string().url().optional().describe("Publisher website"),
  /** Publisher-specific support email */
  supportEmail: zod.z.string().email().optional().describe("Publisher support email"),
  /** Registration timestamp (when org became a publisher) */
  registeredAt: zod.z.string().datetime()
});
var ReleaseChannelSchema = zod.z.enum([
  "alpha",
  // Early development, unstable
  "beta",
  // Feature-complete, testing phase
  "rc",
  // Release candidate, final testing
  "stable"
  // Production-ready, general availability
]);
var VersionReleaseSchema = zod.z.object({
  /** Semver version string */
  version: zod.z.string().describe("Semver version (e.g., 2.1.0-beta.1)"),
  /** Release channel */
  channel: ReleaseChannelSchema.default("stable"),
  /** Release notes (Markdown) */
  releaseNotes: zod.z.string().optional().describe("Release notes (Markdown)"),
  /** Changelog entries (structured) */
  changelog: zod.z.array(zod.z.object({
    type: zod.z.enum(["added", "changed", "fixed", "removed", "deprecated", "security"]),
    description: zod.z.string()
  })).optional().describe("Structured changelog entries"),
  /** Minimum platform version required */
  minPlatformVersion: zod.z.string().optional(),
  /** Build artifact URL */
  artifactUrl: zod.z.string().optional().describe("Built package artifact URL"),
  /** Artifact checksum (integrity) */
  artifactChecksum: zod.z.string().optional().describe("SHA-256 checksum"),
  /** Whether this version is deprecated */
  deprecated: zod.z.boolean().default(false),
  /** Deprecation message (if deprecated) */
  deprecationMessage: zod.z.string().optional(),
  /** Release timestamp */
  releasedAt: zod.z.string().datetime().optional()
});
var CreateListingRequestSchema = zod.z.object({
  /** Package ID (reverse domain, e.g., com.acme.crm) */
  packageId: zod.z.string().describe("Package identifier"),
  /** Display name */
  name: zod.z.string().describe("App display name"),
  /** Short tagline (max 120 chars) */
  tagline: zod.z.string().max(120).optional(),
  /** Full description (Markdown) */
  description: zod.z.string().optional(),
  /** Category */
  category: zod.z.string().describe("Marketplace category"),
  /** Additional tags */
  tags: zod.z.array(zod.z.string()).optional(),
  /** Icon URL */
  iconUrl: zod.z.string().url().optional(),
  /** Screenshots */
  screenshots: zod.z.array(zod.z.object({
    url: zod.z.string().url(),
    caption: zod.z.string().optional()
  })).optional(),
  /** Documentation URL */
  documentationUrl: zod.z.string().url().optional(),
  /** Support URL */
  supportUrl: zod.z.string().url().optional(),
  /** Source repository URL */
  repositoryUrl: zod.z.string().url().optional(),
  /** Pricing model */
  pricing: zod.z.enum([
    "free",
    "freemium",
    "paid",
    "subscription",
    "usage-based",
    "contact-sales"
  ]).default("free"),
  /** Price in cents (if paid) */
  priceInCents: zod.z.number().int().min(0).optional()
});
var UpdateListingRequestSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string().describe("Listing ID to update"),
  /** Updatable fields (all optional, partial update) */
  name: zod.z.string().optional(),
  tagline: zod.z.string().max(120).optional(),
  description: zod.z.string().optional(),
  category: zod.z.string().optional(),
  tags: zod.z.array(zod.z.string()).optional(),
  iconUrl: zod.z.string().url().optional(),
  screenshots: zod.z.array(zod.z.object({
    url: zod.z.string().url(),
    caption: zod.z.string().optional()
  })).optional(),
  documentationUrl: zod.z.string().url().optional(),
  supportUrl: zod.z.string().url().optional(),
  repositoryUrl: zod.z.string().url().optional(),
  pricing: zod.z.enum([
    "free",
    "freemium",
    "paid",
    "subscription",
    "usage-based",
    "contact-sales"
  ]).optional(),
  priceInCents: zod.z.number().int().min(0).optional()
});
var ListingActionRequestSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string().describe("Listing ID"),
  /** Action to perform */
  action: zod.z.enum([
    "submit",
    // Submit for review
    "unlist",
    // Remove from public search (keep accessible by direct link)
    "deprecate",
    // Mark as deprecated
    "reactivate"
    // Reactivate unlisted/deprecated listing
  ]).describe("Action to perform on listing"),
  /** Reason for action (e.g., deprecation message) */
  reason: zod.z.string().optional()
});
var AnalyticsTimeRangeSchema = zod.z.enum([
  "last_7d",
  "last_30d",
  "last_90d",
  "last_365d",
  "all_time"
]);
var PublishingAnalyticsRequestSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string().describe("Listing to get analytics for"),
  /** Time range */
  timeRange: AnalyticsTimeRangeSchema.default("last_30d"),
  /** Metrics to include */
  metrics: zod.z.array(zod.z.enum([
    "installs",
    // Install count over time
    "uninstalls",
    // Uninstall count over time
    "active_installs",
    // Active install trend
    "ratings",
    // Rating distribution
    "revenue",
    // Revenue (for paid apps)
    "page_views"
    // Listing page views
  ])).optional().describe("Metrics to include (default: all)")
});
var TimeSeriesPointSchema = zod.z.object({
  /** ISO date string (day granularity) */
  date: zod.z.string(),
  /** Metric value */
  value: zod.z.number()
});
var PublishingAnalyticsResponseSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string(),
  /** Time range */
  timeRange: AnalyticsTimeRangeSchema,
  /** Summary statistics */
  summary: zod.z.object({
    totalInstalls: zod.z.number().int().min(0),
    activeInstalls: zod.z.number().int().min(0),
    totalUninstalls: zod.z.number().int().min(0),
    averageRating: zod.z.number().min(0).max(5).optional(),
    totalRatings: zod.z.number().int().min(0),
    totalRevenue: zod.z.number().min(0).optional().describe("Revenue in cents"),
    pageViews: zod.z.number().int().min(0)
  }),
  /** Time series data by metric */
  timeSeries: zod.z.record(zod.z.string(), zod.z.array(TimeSeriesPointSchema)).optional().describe("Time series keyed by metric name"),
  /** Rating distribution (1-5 stars) */
  ratingDistribution: zod.z.object({
    1: zod.z.number().int().min(0).default(0),
    2: zod.z.number().int().min(0).default(0),
    3: zod.z.number().int().min(0).default(0),
    4: zod.z.number().int().min(0).default(0),
    5: zod.z.number().int().min(0).default(0)
  }).optional()
});
var ReviewCriterionSchema = zod.z.object({
  /** Criterion identifier */
  id: zod.z.string().describe("Criterion ID"),
  /** Category of criterion */
  category: zod.z.enum([
    "security",
    // Security best practices
    "performance",
    // Performance / resource usage
    "quality",
    // Code quality / best practices
    "ux",
    // User experience standards
    "documentation",
    // Documentation completeness
    "policy",
    // Policy compliance (no malware, GDPR, etc.)
    "compatibility"
    // Platform compatibility
  ]),
  /** Description of what to check */
  description: zod.z.string(),
  /** Whether this criterion must pass for approval */
  required: zod.z.boolean().default(true),
  /** Pass/fail result */
  passed: zod.z.boolean().optional(),
  /** Reviewer notes for this criterion */
  notes: zod.z.string().optional()
});
var ReviewDecisionSchema = zod.z.enum([
  "approved",
  // Approved for publishing
  "rejected",
  // Rejected (with reasons)
  "changes-requested"
  // Needs changes before re-review
]);
var RejectionReasonSchema = zod.z.enum([
  "security-vulnerability",
  // Security issues found
  "policy-violation",
  // Violates marketplace policy
  "quality-below-standard",
  // Does not meet quality bar
  "misleading-metadata",
  // Listing info doesn't match functionality
  "incompatible",
  // Incompatible with current platform
  "duplicate",
  // Duplicate of existing listing
  "insufficient-documentation",
  // Inadequate documentation
  "other"
  // Other reason (see notes)
]);
var SubmissionReviewSchema = zod.z.object({
  /** Review ID */
  id: zod.z.string().describe("Review ID"),
  /** Submission ID being reviewed */
  submissionId: zod.z.string().describe("Submission being reviewed"),
  /** Reviewer user ID */
  reviewerId: zod.z.string().describe("Platform reviewer ID"),
  /** Review decision */
  decision: ReviewDecisionSchema.optional().describe("Final decision"),
  /** Review criteria checklist */
  criteria: zod.z.array(ReviewCriterionSchema).optional().describe("Review checklist results"),
  /** Rejection reasons (if rejected) */
  rejectionReasons: zod.z.array(RejectionReasonSchema).optional(),
  /** Detailed feedback for the developer */
  feedback: zod.z.string().optional().describe("Detailed review feedback (Markdown)"),
  /** Internal notes (not visible to developer) */
  internalNotes: zod.z.string().optional().describe("Internal reviewer notes"),
  /** Review started timestamp */
  startedAt: zod.z.string().datetime().optional(),
  /** Review completed timestamp */
  completedAt: zod.z.string().datetime().optional()
});
var FeaturedListingSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string().describe("Featured listing ID"),
  /** Featured position/priority (lower = higher priority) */
  priority: zod.z.number().int().min(0).default(0),
  /** Featured banner image URL */
  bannerUrl: zod.z.string().url().optional(),
  /** Featured reason / editorial note */
  editorialNote: zod.z.string().optional(),
  /** Start date for featured period */
  startDate: zod.z.string().datetime(),
  /** End date for featured period */
  endDate: zod.z.string().datetime().optional(),
  /** Whether currently active */
  active: zod.z.boolean().default(true)
});
var CuratedCollectionSchema = zod.z.object({
  /** Collection unique identifier */
  id: zod.z.string().describe("Collection ID"),
  /** Collection display name */
  name: zod.z.string().describe("Collection name"),
  /** Collection description */
  description: zod.z.string().optional(),
  /** Cover image URL */
  coverImageUrl: zod.z.string().url().optional(),
  /** Listing IDs in this collection (ordered) */
  listingIds: zod.z.array(zod.z.string()).min(1).describe("Ordered listing IDs"),
  /** Whether publicly visible */
  published: zod.z.boolean().default(false),
  /** Sort order for display among collections */
  sortOrder: zod.z.number().int().min(0).default(0),
  /** Created by (admin user ID) */
  createdBy: zod.z.string().optional(),
  /** Created at */
  createdAt: zod.z.string().datetime().optional(),
  /** Updated at */
  updatedAt: zod.z.string().datetime().optional()
});
var PolicyViolationTypeSchema = zod.z.enum([
  "malware",
  // Malicious software
  "data-harvesting",
  // Unauthorized data collection
  "spam",
  // Spammy or misleading content
  "copyright",
  // Copyright/IP infringement
  "inappropriate-content",
  // Inappropriate or offensive content
  "terms-of-service",
  // General ToS violation
  "security-risk",
  // Unresolved critical security issues
  "abandoned"
  // Abandoned / no longer maintained
]);
var PolicyActionSchema = zod.z.object({
  /** Action ID */
  id: zod.z.string().describe("Action ID"),
  /** Listing ID */
  listingId: zod.z.string().describe("Target listing ID"),
  /** Violation type */
  violationType: PolicyViolationTypeSchema,
  /** Action taken */
  action: zod.z.enum([
    "warning",
    // Warning to publisher
    "suspend",
    // Temporarily suspend listing
    "takedown",
    // Permanently remove listing
    "restrict"
    // Restrict new installs (existing users keep access)
  ]),
  /** Detailed reason */
  reason: zod.z.string().describe("Explanation of the violation"),
  /** Admin user who took the action */
  actionBy: zod.z.string().describe("Admin user ID"),
  /** Timestamp */
  actionAt: zod.z.string().datetime(),
  /** Resolution notes (if resolved) */
  resolution: zod.z.string().optional(),
  /** Whether resolved */
  resolved: zod.z.boolean().default(false)
});
var MarketplaceHealthMetricsSchema = zod.z.object({
  /** Total number of published listings */
  totalListings: zod.z.number().int().min(0),
  /** Listings by status breakdown (partial — only non-zero statuses) */
  listingsByStatus: zod.z.record(zod.z.string(), zod.z.number().int().min(0)).optional(),
  /** Listings by category breakdown (partial — only non-zero categories) */
  listingsByCategory: zod.z.record(zod.z.string(), zod.z.number().int().min(0)).optional(),
  /** Total registered publishers */
  totalPublishers: zod.z.number().int().min(0),
  /** Verified publishers count */
  verifiedPublishers: zod.z.number().int().min(0),
  /** Total installs across all listings (all time) */
  totalInstalls: zod.z.number().int().min(0),
  /** Average time from submission to review completion (hours) */
  averageReviewTime: zod.z.number().min(0).optional(),
  /** Pending review queue size */
  pendingReviews: zod.z.number().int().min(0),
  /** Listings by pricing model (partial — only non-zero models) */
  listingsByPricing: zod.z.record(zod.z.string(), zod.z.number().int().min(0)).optional(),
  /** Snapshot timestamp */
  snapshotAt: zod.z.string().datetime()
});
var TrendingListingSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string(),
  /** Trending rank (1 = most trending) */
  rank: zod.z.number().int().min(1),
  /** Trend score (computed from velocity of installs, ratings, page views) */
  trendScore: zod.z.number().min(0),
  /** Install velocity (installs per day over measurement period) */
  installVelocity: zod.z.number().min(0),
  /** Measurement period (e.g., "7d", "30d") */
  period: zod.z.string()
});
var ReviewModerationStatusSchema = zod.z.enum([
  "pending",
  // Awaiting moderation
  "approved",
  // Approved and visible
  "flagged",
  // Flagged for review
  "rejected"
  // Rejected (spam, inappropriate)
]);
var UserReviewSchema = zod.z.object({
  /** Review ID */
  id: zod.z.string().describe("Review ID"),
  /** Listing ID being reviewed */
  listingId: zod.z.string().describe("Listing being reviewed"),
  /** Reviewer user ID */
  userId: zod.z.string().describe("Review author user ID"),
  /** Reviewer display name */
  displayName: zod.z.string().optional().describe("Reviewer display name"),
  /** Star rating (1-5) */
  rating: zod.z.number().int().min(1).max(5).describe("Star rating (1-5)"),
  /** Review title */
  title: zod.z.string().max(200).optional().describe("Review title"),
  /** Review body text */
  body: zod.z.string().max(5e3).optional().describe("Review text"),
  /** Version the reviewer is using */
  appVersion: zod.z.string().optional().describe("App version being reviewed"),
  /** Moderation status */
  moderationStatus: ReviewModerationStatusSchema.default("pending"),
  /** Number of "helpful" votes from other users */
  helpfulCount: zod.z.number().int().min(0).default(0),
  /** Publisher's response to this review */
  publisherResponse: zod.z.object({
    body: zod.z.string(),
    respondedAt: zod.z.string().datetime()
  }).optional().describe("Publisher response to review"),
  /** Submitted timestamp */
  submittedAt: zod.z.string().datetime(),
  /** Updated timestamp */
  updatedAt: zod.z.string().datetime().optional()
});
var SubmitReviewRequestSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string().describe("Listing to review"),
  /** Star rating (1-5) */
  rating: zod.z.number().int().min(1).max(5).describe("Star rating"),
  /** Review title */
  title: zod.z.string().max(200).optional(),
  /** Review body */
  body: zod.z.string().max(5e3).optional()
});
var ListReviewsRequestSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string().describe("Listing to get reviews for"),
  /** Sort by */
  sortBy: zod.z.enum(["newest", "oldest", "highest", "lowest", "most-helpful"]).default("newest"),
  /** Filter by rating */
  rating: zod.z.number().int().min(1).max(5).optional(),
  /** Pagination */
  page: zod.z.number().int().min(1).default(1),
  pageSize: zod.z.number().int().min(1).max(50).default(10)
});
var ListReviewsResponseSchema = zod.z.object({
  /** Reviews */
  items: zod.z.array(UserReviewSchema),
  /** Total count */
  total: zod.z.number().int().min(0),
  /** Pagination */
  page: zod.z.number().int().min(1),
  pageSize: zod.z.number().int().min(1),
  /** Rating summary */
  ratingSummary: zod.z.object({
    averageRating: zod.z.number().min(0).max(5),
    totalRatings: zod.z.number().int().min(0),
    distribution: zod.z.object({
      1: zod.z.number().int().min(0).default(0),
      2: zod.z.number().int().min(0).default(0),
      3: zod.z.number().int().min(0).default(0),
      4: zod.z.number().int().min(0).default(0),
      5: zod.z.number().int().min(0).default(0)
    })
  }).optional()
});
var RecommendationReasonSchema = zod.z.enum([
  "popular-in-category",
  // Popular in your industry/category
  "similar-users",
  // Used by similar organizations
  "complements-installed",
  // Complements apps you already use
  "trending",
  // Currently trending
  "new-release",
  // Recently released / major update
  "editor-pick"
  // Editorial/curated recommendation
]);
var RecommendedAppSchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string(),
  /** App name */
  name: zod.z.string(),
  /** Short tagline */
  tagline: zod.z.string().optional(),
  /** Icon URL */
  iconUrl: zod.z.string().url().optional(),
  /** Category */
  category: MarketplaceCategorySchema,
  /** Pricing */
  pricing: PricingModelSchema,
  /** Average rating */
  averageRating: zod.z.number().min(0).max(5).optional(),
  /** Active installs */
  activeInstalls: zod.z.number().int().min(0).optional(),
  /** Why this is recommended */
  reason: RecommendationReasonSchema
});
var AppDiscoveryRequestSchema = zod.z.object({
  /** Tenant ID for personalization */
  tenantId: zod.z.string().optional(),
  /** Categories the customer is interested in */
  categories: zod.z.array(MarketplaceCategorySchema).optional(),
  /** Platform version for compatibility filtering */
  platformVersion: zod.z.string().optional(),
  /** Max number of items per section */
  limit: zod.z.number().int().min(1).max(50).default(10)
});
var AppDiscoveryResponseSchema = zod.z.object({
  /** Featured apps (editorial picks) */
  featured: zod.z.array(RecommendedAppSchema).optional(),
  /** Personalized recommendations */
  recommended: zod.z.array(RecommendedAppSchema).optional(),
  /** Trending apps */
  trending: zod.z.array(RecommendedAppSchema).optional(),
  /** Recently added */
  newArrivals: zod.z.array(RecommendedAppSchema).optional(),
  /** Curated collections */
  collections: zod.z.array(zod.z.object({
    id: zod.z.string(),
    name: zod.z.string(),
    description: zod.z.string().optional(),
    coverImageUrl: zod.z.string().url().optional(),
    apps: zod.z.array(RecommendedAppSchema)
  })).optional()
});
var SubscriptionStatusSchema = zod.z.enum([
  "active",
  // Active and paid
  "trialing",
  // Free trial period
  "past-due",
  // Payment overdue
  "cancelled",
  // Cancelled (still active until period ends)
  "expired"
  // Expired / ended
]);
var AppSubscriptionSchema = zod.z.object({
  /** Subscription ID */
  id: zod.z.string().describe("Subscription ID"),
  /** Listing ID */
  listingId: zod.z.string().describe("App listing ID"),
  /** Tenant ID */
  tenantId: zod.z.string().describe("Customer tenant ID"),
  /** Subscription status */
  status: SubscriptionStatusSchema,
  /** License key */
  licenseKey: zod.z.string().optional(),
  /** Plan/tier name (if multiple plans) */
  plan: zod.z.string().optional().describe("Subscription plan name"),
  /** Billing cycle */
  billingCycle: zod.z.enum(["monthly", "annual"]).optional(),
  /** Price per billing cycle (in cents) */
  priceInCents: zod.z.number().int().min(0).optional(),
  /** Current period start */
  currentPeriodStart: zod.z.string().datetime().optional(),
  /** Current period end */
  currentPeriodEnd: zod.z.string().datetime().optional(),
  /** Trial end date (if trialing) */
  trialEndDate: zod.z.string().datetime().optional(),
  /** Whether auto-renew is on */
  autoRenew: zod.z.boolean().default(true),
  /** Created timestamp */
  createdAt: zod.z.string().datetime()
});
var InstalledAppSummarySchema = zod.z.object({
  /** Listing ID */
  listingId: zod.z.string(),
  /** Package ID */
  packageId: zod.z.string(),
  /** Display name */
  name: zod.z.string(),
  /** Icon URL */
  iconUrl: zod.z.string().url().optional(),
  /** Installed version */
  installedVersion: zod.z.string(),
  /** Latest available version */
  latestVersion: zod.z.string().optional(),
  /** Whether an update is available */
  updateAvailable: zod.z.boolean().default(false),
  /** Whether the app is currently enabled */
  enabled: zod.z.boolean().default(true),
  /** Subscription status (for paid apps) */
  subscriptionStatus: SubscriptionStatusSchema.optional(),
  /** Installed timestamp */
  installedAt: zod.z.string().datetime()
});
var ListInstalledAppsRequestSchema = zod.z.object({
  /** Tenant ID */
  tenantId: zod.z.string().optional(),
  /** Filter by enabled/disabled */
  enabled: zod.z.boolean().optional(),
  /** Filter by update availability */
  updateAvailable: zod.z.boolean().optional(),
  /** Sort by */
  sortBy: zod.z.enum(["name", "installed-date", "updated-date"]).default("name"),
  /** Pagination */
  page: zod.z.number().int().min(1).default(1),
  pageSize: zod.z.number().int().min(1).max(100).default(20)
});
var ListInstalledAppsResponseSchema = zod.z.object({
  /** Installed apps */
  items: zod.z.array(InstalledAppSummarySchema),
  /** Total count */
  total: zod.z.number().int().min(0),
  /** Pagination */
  page: zod.z.number().int().min(1),
  pageSize: zod.z.number().int().min(1)
});

exports.AnalyticsTimeRangeSchema = AnalyticsTimeRangeSchema;
exports.AppDiscoveryRequestSchema = AppDiscoveryRequestSchema;
exports.AppDiscoveryResponseSchema = AppDiscoveryResponseSchema;
exports.AppSubscriptionSchema = AppSubscriptionSchema;
exports.ArtifactDownloadResponseSchema = ArtifactDownloadResponseSchema;
exports.ArtifactReferenceSchema = ArtifactReferenceSchema;
exports.CreateListingRequestSchema = CreateListingRequestSchema;
exports.CuratedCollectionSchema = CuratedCollectionSchema;
exports.FeaturedListingSchema = FeaturedListingSchema;
exports.InstalledAppSummarySchema = InstalledAppSummarySchema;
exports.ListInstalledAppsRequestSchema = ListInstalledAppsRequestSchema;
exports.ListInstalledAppsResponseSchema = ListInstalledAppsResponseSchema;
exports.ListReviewsRequestSchema = ListReviewsRequestSchema;
exports.ListReviewsResponseSchema = ListReviewsResponseSchema;
exports.ListingActionRequestSchema = ListingActionRequestSchema;
exports.ListingStatusSchema = ListingStatusSchema;
exports.MarketplaceCategorySchema = MarketplaceCategorySchema;
exports.MarketplaceHealthMetricsSchema = MarketplaceHealthMetricsSchema;
exports.MarketplaceInstallRequestSchema = MarketplaceInstallRequestSchema;
exports.MarketplaceInstallResponseSchema = MarketplaceInstallResponseSchema;
exports.MarketplaceListingSchema = MarketplaceListingSchema;
exports.MarketplaceSearchRequestSchema = MarketplaceSearchRequestSchema;
exports.MarketplaceSearchResponseSchema = MarketplaceSearchResponseSchema;
exports.PackageSubmissionSchema = PackageSubmissionSchema;
exports.PolicyActionSchema = PolicyActionSchema;
exports.PolicyViolationTypeSchema = PolicyViolationTypeSchema;
exports.PricingModelSchema = PricingModelSchema;
exports.PublisherProfileSchema = PublisherProfileSchema;
exports.PublisherSchema = PublisherSchema;
exports.PublisherVerificationSchema = PublisherVerificationSchema;
exports.PublishingAnalyticsRequestSchema = PublishingAnalyticsRequestSchema;
exports.PublishingAnalyticsResponseSchema = PublishingAnalyticsResponseSchema;
exports.RecommendationReasonSchema = RecommendationReasonSchema;
exports.RecommendedAppSchema = RecommendedAppSchema;
exports.RejectionReasonSchema = RejectionReasonSchema;
exports.ReleaseChannelSchema = ReleaseChannelSchema;
exports.ReviewCriterionSchema = ReviewCriterionSchema;
exports.ReviewDecisionSchema = ReviewDecisionSchema;
exports.ReviewModerationStatusSchema = ReviewModerationStatusSchema;
exports.SubmissionReviewSchema = SubmissionReviewSchema;
exports.SubmitReviewRequestSchema = SubmitReviewRequestSchema;
exports.SubscriptionStatusSchema = SubscriptionStatusSchema;
exports.TimeSeriesPointSchema = TimeSeriesPointSchema;
exports.TrendingListingSchema = TrendingListingSchema;
exports.UpdateListingRequestSchema = UpdateListingRequestSchema;
exports.UserReviewSchema = UserReviewSchema;
exports.VersionReleaseSchema = VersionReleaseSchema;
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map