// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
	"name": "Senior CI",
	"build": {
		"dockerfile": "Dockerfile",
		"context": ".."
	},
	// Features to add to the dev container. More info: https://containers.dev/features.
	"features": {
		"ghcr.io/devcontainers/features/node:1": {
			"version": "20",
			"pnpmVersion": "none",
			"nvmVersion": "latest"
		},
		"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
			"clean_ppas": true,
			"preserve_apt_list": true,
			"packages": "openjdk-21-jdk",
			"ppas": "ppa:deadsnakes/ppa"
		},
		"ghcr.io/devcontainers-extra/features/lefthook-asdf:1": {
			"version": "latest"
		},
		"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
			"plugins": "git zsh-autosuggestions zsh-syntax-highlighting fast-syntax-highlighting",
			"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-syntax-highlighting https://github.com/zdharma-continuum/fast-syntax-highlighting",
			"username": "vscode"
		}
	},
	"containerEnv": {
		"PYTHONUNBUFFERED": "1",
		"TZ": "America/Sao_Paulo",
		"JAVA_HOME": "/usr/lib/jvm/java-21-openjdk-amd64/bin/java"
	},
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],
	// Use 'initializeCommand' to run commands before the container is initialize.
	// It will run on host machine.
	"initializeCommand": "echo '{ \"path\": \"@seniorsistemas/cz-conventional-senior\" }' > ~/.czrc && git config --local core.editor cat && git stash && git pull origin `git rev-parse --abbrev-ref HEAD` && git branch --merged | grep -v '^\\*' | grep -v 'develop' | grep -v 'master' | xargs -I % git branch -d % || true && git remote prune origin && git stash pop || true",
	// Use 'postCreateCommand' to run commands after the container is created.
	"postCreateCommand": "npm install -g @commitlint/cli@19 @seniorsistemas/commitlint-config-senior@1 commitizen@4 @seniorsistemas/cz-conventional-senior@1 && lefthook install",
	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			// Set *default* container specific settings.json values on container create.
			"settings": {
				//Extensions Setting
				"terminal.integrated.defaultProfile.linux": "zsh",
				"python.languageServer": "Pylance",
				"python.formatting.provider": "none",
				"[python]": {
					"editor.showUnused": false,
					"editor.defaultFormatter": "ms-python.black-formatter"
				},
				"sonarlint.focusOnNewCode": true,
				"sonarlint.connectedMode.project": {
					"connectionId": "SonarQubeSenior",
					"projectKey": "devops-senior-ci"
				},
				"cSpell.enabled": true,
				"cSpell.language": "en,en-US,pt,pt_BR",
				"cSpell.words": [
					"seniorsa",
					"dockerhub",
					"trivy",
					"dotnet",
					"buildable",
					"gitlab",
					"argocd"
				],
				"cSpell.ignorePaths": [
					".devcontainer",
					".pylint",
					"requirements.txt",
					"requirements-dev.txt"
				]
			},
			// Add the IDs of extensions you want installed when the container is created.
			"extensions": [
				"eamodio.gitlens",
				"streetsidesoftware.code-spell-checker",
				"streetsidesoftware.code-spell-checker-portuguese-brazilian",
				"SonarSource.sonarlint-vscode",
				"ms-python.python",
				"ms-python.vscode-pylance",
				"ms-python.black-formatter",
				"ms-python.isort",
				"ms-python.pylint"
			]
		}
	},
	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "root"
	"mounts": [
		{
			"source": "${localEnv:HOME}${localEnv:USERPROFILE}/.czrc",
			"target": "/home/vscode/.czrc",
			"type": "bind"
		}
	]
}