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

import (
	"time"

	core "github.com/meshery/schemas/models/core"
	planv1beta3 "github.com/meshery/schemas/models/v1beta3/plan"
	openapi_types "github.com/oapi-codegen/runtime/types"
	"github.com/gofrs/uuid"
)

// Defines values for PaymentProcessor.
const (
	Braintree PaymentProcessor = "braintree"
	Paypal    PaymentProcessor = "paypal"
	Stripe    PaymentProcessor = "stripe"
)

// Defines values for SubscriptionStatus.
const (
	Active            SubscriptionStatus = "active"
	Canceled          SubscriptionStatus = "canceled"
	Incomplete        SubscriptionStatus = "incomplete"
	IncompleteExpired SubscriptionStatus = "incomplete_expired"
	PastDue           SubscriptionStatus = "past_due"
	Trialing          SubscriptionStatus = "trialing"
	Unpaid            SubscriptionStatus = "unpaid"
)

// CancelSubscriptionRequest Payload for cancelling a subscription in an external processor.
type CancelSubscriptionRequest struct {
	// PaymentProcessor Payment processor used to charge the subscription.
	PaymentProcessor *PaymentProcessor `json:"paymentProcessor,omitempty" yaml:"paymentProcessor,omitempty"`

	// SubscriptionId Subscription ID from the payment processor.
	SubscriptionId *string `json:"subscriptionId,omitempty" yaml:"subscriptionId,omitempty"`
}

// CreateSubscriptionRequest Payload for creating a new subscription through a payment processor.
type CreateSubscriptionRequest struct {
	// CouponId Coupon ID to apply.
	CouponId *string `json:"couponId,omitempty" yaml:"couponId,omitempty"`

	// Email Email of the customer.
	Email *openapi_types.Email `json:"email,omitempty" yaml:"email,omitempty"`

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

	// PaymentProcessor Payment processor used to charge the subscription.
	PaymentProcessor *PaymentProcessor `json:"paymentProcessor,omitempty" yaml:"paymentProcessor,omitempty"`

	// PlanId Price ID from the payment processor.
	PlanId *string `json:"planId,omitempty" yaml:"planId,omitempty"`

	// UserCount Number of users in the organization.
	UserCount *int `json:"userCount,omitempty" yaml:"userCount,omitempty"`
}

// CreateSubscriptionResponse Response body returned after a subscription is created.
type CreateSubscriptionResponse struct {
	// ClientSecret Client secret returned by the payment processor for the subscription checkout flow.
	ClientSecret *string `json:"clientSecret,omitempty" yaml:"clientSecret,omitempty"`

	// SubscriptionId ID of the associated subscription in the payment processor.
	SubscriptionId *string `json:"subscriptionId,omitempty" yaml:"subscriptionId,omitempty"`
}

// PaymentProcessor Payment processor used to charge the subscription.
type PaymentProcessor string

// Subscription Subscription entity schema.
type Subscription struct {
	// BillingID Billing ID of the subscription. The ID of the subscription in the external billing system (for example, Stripe).
	BillingID string `db:"billing_id" json:"billingId" yaml:"billingId"`

	// CreatedAt Timestamp when the subscription was created.
	CreatedAt time.Time                `db:"created_at" json:"createdAt" yaml:"createdAt"`
	DeletedAt core.SqlNullTime `db:"deleted_at" json:"deletedAt,omitempty" yaml:"deletedAt,omitempty"`

	// EndDate Timestamp when the current subscription period ends.
	EndDate time.Time `db:"end_date" json:"endDate" yaml:"endDate"`

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

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

	// Plan Plan entity schema.
	Plan *planv1beta3.Plan `fk_id:"PlanID" belongs_to:"plans" json:"plan,omitempty" yaml:"plan,omitempty"`

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

	// Quantity Number of units subscribed (eg number of users).
	Quantity int `db:"quantity" json:"quantity" yaml:"quantity"`

	// StartDate Timestamp when the subscription period started.
	StartDate time.Time `db:"start_date" json:"startDate" yaml:"startDate"`

	// Status Possible statuses of a Stripe subscription.
	Status SubscriptionStatus `db:"status" json:"status" yaml:"status"`

	// UpdatedAt Timestamp when the subscription was last updated.
	UpdatedAt time.Time `db:"updated_at" json:"updatedAt" yaml:"updatedAt"`
}

// SubscriptionPage Paginated list of subscriptions.
type SubscriptionPage struct {
	// Page Current page number of the result set.
	Page int `json:"page" yaml:"page"`

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

	// Subscriptions Subscriptions returned on the current page.
	Subscriptions []Subscription `json:"subscriptions" yaml:"subscriptions"`

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

// SubscriptionStatus Possible statuses of a Stripe subscription.
type SubscriptionStatus string

// UpdateUsersRequest Payload for synchronizing the current user count with the payment processor.
type UpdateUsersRequest struct {
	// PaymentProcessor Payment processor used to charge the subscription.
	PaymentProcessor *PaymentProcessor `json:"paymentProcessor,omitempty" yaml:"paymentProcessor,omitempty"`
}

// UpgradeSubscriptionRequest Payload for upgrading or downgrading a subscription by changing one of its plans.
type UpgradeSubscriptionRequest struct {
	// NewPlanId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	NewPlanId *core.Uuid `json:"newPlanId,omitempty" yaml:"newPlanId,omitempty"`

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

// WebhookEvent Payload for webhook events from payment processors.
type WebhookEvent = map[string]interface{}

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

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

// Pagesize defines model for pagesize.
type Pagesize = int

// PagesizeWithAll defines model for pagesizeWithAll.
type PagesizeWithAll = string

// SubscriptionId defines model for subscriptionId.
type SubscriptionId = uuid.UUID
