package tui import ( tea "charm.land/bubbletea/v2" ) type Model struct { currentStep step cursor int dockerInstalled bool checkDockerDone bool checkProgress float64 isPublicIP bool serverForm FormStep dbForm FormStep certForm FormStep configValues ConfigValues err error } type ConfigValues struct { Server map[string]string Database map[string]string Cert map[string]string } func InitialModel() Model { return Model{ currentStep: StepCheckDocker, serverForm: NewFormStep("Servidor", []FormField{ { Label: "Porta", Placeholder: "8081", Default: "8081", Type: FieldTypeNumber, CharLimit: 4, }, { Label: "Timeout (Segundos)", Placeholder: "30", Default: "30", Type: FieldTypeNumber, CharLimit: 3, }, { Label: "Ambiente", Default: "production", Type: FieldTypeSelect, Options: []string{"development", "production"}, }, }), dbForm: NewFormStep("Banco de Dados", []FormField{ { Label: "Tipo do Banco", Default: "postgres", Type: FieldTypeSelect, Options: []string{"postgres", "oracle"}, }, { Label: "URL de acesso", Placeholder: "postgres://usuario:senha@banco:5432/app_dono_db", Default: "postgres://usuario:senha@banco:5432/app_dono_db", Type: FieldTypeText, }, { Label: "Conexões ativas (máximo)", Placeholder: "10", Default: "10", Type: FieldTypeNumber, }, { Label: "Conexões ativas (mínimo)", Placeholder: "2", Default: "2", Type: FieldTypeNumber, }, }), certForm: NewFormStep("Certificado", []FormField{ { Label: "Caminho para o arquivo do certificado", Placeholder: "/caminho/para/certificado.crt", Default: "/caminho/para/certificado.crt", Type: FieldTypeText, }, { Label: "Caminho para o arquivo da chave", Placeholder: "/caminho/para/chave.key", Default: "/caminho/para/chave.key", Type: FieldTypeText, }, { Label: "Caminho para o arquivo da autoridade certificadora", Placeholder: "/caminho/para/chaveCA.crt", Default: "/caminho/para/chaveCA.crt", Type: FieldTypeText, }, { Label: "Nome do servidor", Placeholder: "client", Default: "client", Type: FieldTypeText, }, }), } } func (m Model) Init() tea.Cmd { return tea.Batch(CheckDockerCmd(), tickCmd()) }