/*
Copyright (c) 2026.

MIT License - see LICENSE file for details.
*/

package tools

import "github.com/sozercan/orka/internal/workerenv"

const (
	envOrkaTaskName                  = workerenv.TaskName
	envOrkaTaskNamespace             = workerenv.TaskNamespace
	envOrkaParentTask                = workerenv.ParentTask
	envOrkaControllerURL             = workerenv.ControllerURL
	envOrkaCoordinationDepth         = workerenv.CoordinationDepth
	envOrkaCoordinationAllowedAgents = workerenv.CoordinationAllowedAgents
	envOrkaCoordinationMaxDepth      = workerenv.CoordinationMaxDepth

	noNewMessagesText               = "No new messages"
	agentNameDescription            = "Agent name"
	namespaceDescription            = "Namespace"
	taskNameDescription             = "Task name"
	cronScheduleDescription         = "Cron schedule for recurring tasks (e.g., '0 */6 * * *' for every 6 hours, '0 9 * * 1-5' for weekdays at 9am, '*/5 * * * *' for every 5 minutes). Leave empty for one-time tasks."
	workspaceTaskDescription        = "Name of a task whose workspace config has the repo and git credentials"
	childWorkspaceTaskDescription   = "Name of the child task whose workspace config has the repo and git credentials"
	timeoutDescription              = "Timeout duration, e.g. \"5m\""
	missingControllerTaskEnvMessage = workerenv.ControllerURL + ", " + workerenv.TaskName + ", and " + workerenv.TaskNamespace + " are required"
	shortPollIntervalString         = "100ms"
	taskPhasePendingString          = "Pending"
	taskPhaseRunningString          = "Running"
	taskPhaseSucceededString        = "Succeeded"
	taskPhaseFailedString           = "Failed"
	taskPhaseErrorString            = "Error"
	reviewEventApprove              = "APPROVE"
	reviewEventRequestChanges       = "REQUEST_CHANGES"
	reviewEventComment              = "COMMENT"
	testToolDescription             = "A test tool"
	jsonSchemaTypeArray             = "array"
	jsonSchemaTypeBoolean           = "boolean"
	codeLanguageBash                = "bash"
	codeLanguageShell               = "sh"
	githubBodyField                 = "body"
	githubCommitTitleField          = "commit_title"
	githubCommitMessageField        = "commit_message"
	agentRefField                   = "agentRef"
	taskKindString                  = "Task"
	cancelledStatusString           = "cancelled"
	createAgentToolName             = "create_agent"
	checkMessagesToolName           = "check_messages"
	checkPullRequestCIToolName      = "check_pull_request_ci"
	checkPRReviewMarkerToolName     = "check_pr_review_marker"
	checkTaskProgressToolName       = "check_task_progress"
	cancelTaskToolName              = "cancel_task"
	autoMergePullRequestToolName    = "auto_merge_pull_request"
	pullRequestMergedMessage        = "Pull request merged successfully"
	httpMethodGetString             = "GET"
	httpMethodPostString            = "POST"
	defaultWorkspacePath            = "/workspace"
	tempDirPath                     = "/tmp"
	cUTF8Locale                     = "C.UTF-8"
	testRepositoryName              = "ayna"
	testPullRequestTitle            = "Test PR"
	testAgentTaskGeneratedName      = "agent-task-1"
	testContainerTaskGeneratedName  = "container-task-1"
	testCoderTaskName               = "coder-task"
	testChildTaskName               = "child-task-1"
	testCoordinatorTaskName         = "coordinator"
	testCoderAgentName              = "coder"
	testClaudeCoderName             = "claude-coder"
	runtimeTypeClaude               = "claude"
	claudeCredentialsSecretName     = "claude-credentials"
	claudeAPIKeySecretName          = "claude-api-key"
	codexRuntimeCopilotSecretName   = "codex-runtime-copilot"
	codexProxyTokenSecretName       = "codex-proxy-token"
	testSecondToolDescription       = "Second tool"
	testTool1Description            = "Tool 1"

	jsonSchemaDescriptionField    = "description"
	jsonSchemaEnumField           = "enum"
	enabledString                 = "enabled"
	failedStatusString            = "failed"
	deletedStatusString           = "deleted"
	createAITaskToolName          = "create_ai_task"
	createPRMonitorToolName       = "create_pr_monitor"
	createAgentTaskToolName       = "create_agent_task"
	createContainerTaskToolName   = "create_container_task"
	createPullRequestToolName     = "create_pull_request"
	listPullRequestsToolName      = "list_pull_requests"
	createToolCRDToolName         = "create_tool"
	deleteToolToolName            = "delete_tool"
	deleteSessionToolName         = "delete_session"
	delegateTaskToolName          = "delegate_task"
	githubReviewEventField        = "event"
	testCustomCopilotSecretName   = "custom-copilot-secret"
	testCustomNamespaceCaseName   = "custom namespace"
	failedToParseArgumentsMessage = "failed to parse arguments"
)

const (
	jsonSchemaTypeField       = "type"
	jsonSchemaTypeString      = "string"
	jsonSchemaTypeObject      = "object"
	jsonSchemaTypeInteger     = "integer"
	jsonSchemaPropertiesField = "properties"
	jsonSchemaRequiredField   = "required"
	nameField                 = "name"
	namespaceField            = "namespace"
	taskNameField             = "task_name"
	tokenKey                  = "token"
	messageField              = "message"
	timeoutField              = "timeout"
	githubPRNumberField       = "pr_number"
	headSHAField              = "head_sha"
	urlField                  = "url"
	passwordKey               = "password"
	repoURLField              = "repo_url"
	phaseField                = "phase"
	githubIssueNumberField    = "issue_number"
	promptField               = "prompt"
	sessionIDField            = "sessionId"
	itemsField                = "items"
	runtimeField              = "runtime"
	statusField               = "status"
	scheduleField             = "schedule"
	modelField                = "model"
	systemPromptField         = "systemPrompt"
	mergeMethodField          = "merge_method"
	methodField               = "method"
	pageField                 = "page"
	perPageField              = "per_page"
	secretRefField            = "secretRef"
	workspaceField            = "workspace"
	priorTaskField            = "prior_task"
	providerRefField          = "providerRef"
	resultField               = "result"
	jobField                  = "job"
	limitField                = "limit"
	titleField                = "title"
	toolsField                = "tools"
	priorityField             = "priority"
)

const (
	codeLanguagePython     = "python"
	codeLanguageNode       = "node"
	codeLanguageJavaScript = "javascript"
	python3BinaryName      = "python3"
	falseStr               = "false"
	mergeMethodMerge       = "merge"
	mergeMethodRebase      = "rebase"
	providerOpenAI         = "openai"
	errTypeNotFound        = "not_found"
	internalErrorType      = "internal_error"
	managedByLabelValue    = "orka.ai/managed"
)

const (
	fileReadToolName          = "file_read"
	fileWriteToolName         = "file_write"
	fetchTaskOutputToolName   = "fetch_task_output"
	listAgentsToolName        = "list_agents"
	listTasksToolName         = "list_tasks"
	listToolsToolName         = "list_tools"
	mergePullRequestToolName  = "merge_pull_request"
	postReviewCommentToolName = "post_review_comment"
	reviewPullRequestToolName = "review_pull_request"
	updateAgentToolName       = "update_agent"
	updatePlanToolName        = "update_plan"
	waitForTaskToolName       = "wait_for_task"
	waitForTasksToolName      = "wait_for_tasks"
	webFetchToolName          = "web_fetch"
)

const (
	testGitCredsSecretName     = "git-creds"
	testSozercanAynaRepoURL    = "https://github.com/sozercan/ayna"
	testOrgTestRepoURL         = "https://github.com/testorg/testrepo"
	testNamespace              = "test-ns"
	testMyToolName             = "my-tool"
	testNonexistentName        = "nonexistent"
	testMyTaskName             = "my-task"
	testResearcherAgentName    = "researcher"
	testGitHubOwner            = "sozercan"
	testWorkerAName            = "worker-a"
	testMyAgentName            = "my-agent"
	testTool1Name              = "tool1"
	testOrgRepoURL             = "https://github.com/org/repo"
	testRuntimeCredsSecretName = "runtime-creds"
	testTaskBName              = "task-b"
	testToolName               = "test_tool"
	testProdNamespace          = "prod"
	testFeatureBranch          = "feature/x"
	testTaskAName              = "task-a"
	testAgentName              = "test-agent"
	testHelloText              = "hello"
	exampleDotComURL           = "http://example.com"
	exampleAPIURL              = "http://example.com/api"
	localhostURL               = "http://localhost"
	testMyOrgRepoURL           = "https://github.com/myorg/myrepo"
	otherSecretKey             = "other-key"
	testReviewBody             = "review"
	testSiblingTaskName        = "sibling-1"
	testTaskOKName             = "task-ok"
	testTool2Name              = "tool2"
	testEditCommitTitle        = "feat: edit message"
	testEditMessageBranch      = "feature/edit-msg"
	testGPT4OModel             = "gpt-4o"
	helloOutputString          = "hello\n"
	testNoWorkspaceTaskName    = "no-ws-task"
	testPriorTaskName          = "prior-task-1"
	testRunningTaskName        = "running-task"
	testSessionID              = "sess-123"
	testCommentBody            = "some comment"
	testTaskFailName           = "task-fail"
	testTaskPendingName        = "task-pending"
	testPlanJSON               = `{"summary":"test","plan_document":"# Plan"}`
	invalidJSONText            = "{invalid}"
	testGitHubToken            = "test-token"
)

const (
	invalidJSONArgsCaseName       = "invalid JSON args"
	serverErrorMessage            = "server error"
	invalidArgumentsMessage       = "invalid arguments"
	missingNameCaseName           = "missing name"
	passedStatusString            = "passed"
	taskNotFoundCaseName          = "task not found"
	invalidTimeoutCaseName        = "invalid timeout"
	k8sAlreadyExistsErrorCaseName = "k8s already exists error"
	mergedStatusString            = "merged"
	notFoundMessage               = "not found"
	successStatusString           = "success"
)
