package types

type Project struct {
	ID                     uint    `json:"id"`
	Name                   string  `json:"name"`
	Roles                  []*Role `json:"roles"`
	PreviewEnvsEnabled     bool    `json:"preview_envs_enabled"`
	RDSDatabasesEnabled    bool    `json:"enable_rds_databases"`
	ManagedInfraEnabled    bool    `json:"managed_infra_enabled"`
	APITokensEnabled       bool    `json:"api_tokens_enabled"`
	StacksEnabled          bool    `json:"stacks_enabled"`
	CapiProvisionerEnabled bool    `json:"capi_provisioner_enabled"`
	SimplifiedViewEnabled  bool    `json:"simplified_view_enabled"`
	AzureEnabled           bool    `json:"azure_enabled"`
	HelmValuesEnabled      bool    `json:"helm_values_enabled"`
	MultiCluster           bool    `json:"multi_cluster"`
	EnableReprovision      bool    `json:"enable_reprovision"`
	ValidateApplyV2        bool    `json:"validate_apply_v2"`
}

type FeatureFlags struct {
	PreviewEnvironmentsEnabled string `json:"preview_environments_enabled,omitempty"`
	ManagedInfraEnabled        string `json:"managed_infra_enabled,omitempty"`
	StacksEnabled              string `json:"stacks_enabled,omitempty"`
	ManagedDatabasesEnabled    string `json:"managed_databases_enabled,omitempty"`
	CapiProvisionerEnabled     string `json:"capi_provisioner_enabled,omitempty"`
	SimplifiedViewEnabled      string `json:"simplified_view_enabled,omitempty"`
	AzureEnabled               bool   `json:"azure_enabled,omitempty"`
	HelmValuesEnabled          bool   `json:"helm_values_enabled,omitempty"`
	MultiCluster               bool   `json:"multi_cluster,omitempty"`
	EnableReprovision          bool   `json:"enable_reprovision,omitempty"`
	ValidateApplyV2            bool   `json:"validate_apply_v2"`
}

type CreateProjectRequest struct {
	Name string `json:"name" form:"required"`
}

type CreateProjectResponse Project

type CreateProjectRoleRequest struct {
	Kind   string `json:"kind" form:"required"`
	UserID uint   `json:"user_id" form:"required"`
}

type ProjectInviteAdminRequest struct{}

type ReadProjectResponse Project

type ListProjectsRequest struct{}

type ListProjectsResponse []Project

type DeleteProjectRequest struct {
	Name string `json:"name" form:"required"`
}

type DeleteProjectResponse Project

type ListProjectInfraResponse []*Infra

type GetProjectPolicyResponse []*PolicyDocument

type ListProjectRolesResponse []RoleKind

type Collaborator struct {
	ID        uint   `json:"id"`
	Kind      string `json:"kind"`
	UserID    uint   `json:"user_id"`
	Email     string `json:"email"`
	ProjectID uint   `json:"project_id"`
}

type ListCollaboratorsResponse []*Collaborator

type UpdateRoleRequest struct {
	UserID uint   `json:"user_id,required"`
	Kind   string `json:"kind,required"`
}

type UpdateRoleResponse struct {
	*Role
}

type DeleteRoleRequest struct {
	UserID uint `schema:"user_id,required"`
}

type DeleteRoleResponse struct {
	*Role
}

type GetBillingTokenResponse struct {
	Token  string `json:"token"`
	TeamID string `json:"team_id"`
}

type GetProjectBillingResponse struct {
	HasBilling bool `json:"has_billing"`
}

type StepEnum string

const (
	StepConnectSource StepEnum = "connect_source"
	StepGithub        StepEnum = "github"
)

type ConnectedSourceType string

const (
	ConnectedSourceTypeGithub = "github"
	ConnectedSourceTypeDocker = "docker"
)

type OnboardingData struct {
	CurrentStep                    StepEnum            `json:"current_step"`
	ConnectedSource                ConnectedSourceType `json:"connected_source"`
	SkipRegistryConnection         bool                `json:"skip_registry_connection"`
	SkipResourceProvision          bool                `json:"skip_resource_provision"`
	RegistryConnectionID           uint                `json:"registry_connection_id"`
	RegistryConnectionCredentialID uint                `json:"registry_connection_credential_id"`
	RegistryConnectionProvider     string              `json:"registry_connection_provider"`
	RegistryInfraID                uint                `json:"registry_infra_id"`
	RegistryInfraCredentialID      uint                `json:"registry_infra_credential_id"`
	RegistryInfraProvider          string              `json:"registry_infra_provider"`
	ClusterInfraID                 uint                `json:"cluster_infra_id"`
	ClusterInfraCredentialID       uint                `json:"cluster_infra_credential_id"`
	ClusterInfraProvider           string              `json:"cluster_infra_provider"`
}

type UpdateOnboardingRequest OnboardingData

type UpdateOnboardingStepRequest struct {
	Step              string `json:"step" form:"required,max=255"`
	Provider          string `json:"provider"`
	AccountId         string `json:"account_id"`
	CloudformationURL string `json:"cloudformation_url"`
	ErrorMessage      string `json:"error_message"`
	LoginURL          string `json:"login_url"`
	Region            string `json:"region"`
	// ExternalId used as a 'password' for the aws assume role chain to porter-manager role
	ExternalId string `json:"external_id"`
}
