# generated by datamodel-codegen:
#   filename:  schema.json
#   timestamp: 2024-12-13T02:06:43+00:00
# using the command:
#   datamodel-codegen --input tests\usethis\_integrations\pre_commit\schema.json --input-file-type jsonschema --output src\usethis\_integrations\pre_commit\schema.py --enum-field-as-literal all --field-constraints --use-double-quotes --use-union-operator --use-standard-collections --use-default-kwarg --output-model-type pydantic_v2.BaseModel --target-python-version 3.10
# ruff: noqa: ERA001
# pyright: reportGeneralTypeIssues=false
# plus manually remove default for LocalRepo.repo
# plus manually add HookDefinition.require_serial for type hinting


from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, ConfigDict, Field, RootModel


class Ci(BaseModel):
    autofix_commit_msg: str | None = Field(
        default="[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
        description="A commit message for pull request autofixes\nhttps://pre-commit.ci/#configuration",
    )
    autofix_prs: bool | None = Field(
        default=True,
        description="Whether to autofix pull requests\nhttps://pre-commit.ci/#configuration",
    )
    autoupdate_branch: str | None = Field(
        default="",
        description="A branch to send pull request's autoupdate to\nhttps://pre-commit.ci/#configuration",
    )
    autoupdate_commit_msg: str | None = Field(
        default="[pre-commit.ci] pre-commit autoupdate",
        description="A commit message for autoupdate pull requests\nhttps://pre-commit.ci/#configuration",
    )
    autoupdate_schedule: Literal["weekly", "monthly", "quarterly"] | None = Field(
        default="weekly",
        description="An autoupdate frequency\nhttps://pre-commit.ci/#configuration",
    )
    skip: list[str] | None = Field(
        default=None,
        description="List of skipped hook's ids\nhttps://pre-commit.ci/#configuration",
    )
    submodules: bool | None = Field(
        default=False,
        description="Whether to recursively check out submodules\nhttps://pre-commit.ci/#configuration",
    )


class Language(
    RootModel[
        Literal[
            "conda",
            "coursier",
            "dart",
            "docker",
            "docker_image",
            "dotnet",
            "fail",
            "golang",
            "lua",
            "node",
            "perl",
            "python",
            "python_venv",
            "r",
            "ruby",
            "rust",
            "swift",
            "pygrep",
            "script",
            "system",
        ]
        | str
    ]
):
    root: (
        Literal[
            "conda",
            "coursier",
            "dart",
            "docker",
            "docker_image",
            "dotnet",
            "fail",
            "golang",
            "lua",
            "node",
            "perl",
            "python",
            "python_venv",
            "r",
            "ruby",
            "rust",
            "swift",
            "pygrep",
            "script",
            "system",
        ]
        | str
    )


class FileType(
    RootModel[
        Literal[
            "adobe-illustrator",
            "alpm",
            "apinotes",
            "asar",
            "asciidoc",
            "ash",
            "asm",
            "aspectj",
            "audio",
            "avif",
            "awk",
            "babelrc",
            "bash",
            "batch",
            "bats",
            "bazel",
            "bazelrc",
            "bib",
            "binary",
            "bitmap",
            "bowerrc",
            "browserslistrc",
            "bzip2",
            "c",
            "c#",
            "c++",
            "c2hs",
            "cbsd",
            "clojure",
            "clojurescript",
            "cmake",
            "codespellrc",
            "coffee",
            "coveragerc",
            "crystal",
            "csh",
            "cson",
            "csproj",
            "css",
            "csslintrc",
            "csv",
            "cuda",
            "cython",
            "dart",
            "dash",
            "def",
            "diff",
            "directory",
            "dockerfile",
            "dockerignore",
            "dotenv",
            "dtd",
            "editorconfig",
            "edn",
            "ejs",
            "eot",
            "eps",
            "erb",
            "executable",
            "expect",
            "file",
            "fish",
            "flake8",
            "gdscript",
            "geojson",
            "gherkin",
            "gif",
            "gitattributes",
            "gitconfig",
            "gitignore",
            "gitlint",
            "gitmodules",
            "go",
            "go-mod",
            "go-sum",
            "gotmpl",
            "gpx",
            "graphql",
            "groovy",
            "gyb",
            "gyp",
            "gzip",
            "handlebars",
            "haskell",
            "hcl",
            "header",
            "hgrc",
            "html",
            "icalendar",
            "icns",
            "icon",
            "idl",
            "idris",
            "image",
            "inc",
            "ini",
            "inl",
            "ino",
            "inx",
            "jade",
            "jar",
            "java",
            "java-properties",
            "javascript",
            "jenkins",
            "jinja",
            "jpeg",
            "jshintrc",
            "json",
            "json5",
            "jsonnet",
            "jsx",
            "jupyter",
            "kml",
            "kotlin",
            "ksh",
            "lean",
            "lektor",
            "lektorproject",
            "less",
            "liquid",
            "literate-haskell",
            "lua",
            "mailmap",
            "makefile",
            "manifest",
            "map",
            "markdown",
            "mdx",
            "mention-bot",
            "meson",
            "mib",
            "modulemap",
            "musescore",
            "myst",
            "ngdoc",
            "nim",
            "nimble",
            "nix",
            "non-executable",
            "npmignore",
            "nunjucks",
            "objective-c",
            "objective-c++",
            "ocaml",
            "otf",
            "p12",
            "pdbrc",
            "pdf",
            "pem",
            "perl",
            "php",
            "pkgbuild",
            "plain-text",
            "plantuml",
            "plist",
            "png",
            "pofile",
            "powershell",
            "prettierignore",
            "prisma",
            "proto",
            "puppet",
            "purescript",
            "pyi",
            "pylintrc",
            "pypirc",
            "pyproj",
            "python",
            "python2",
            "python3",
            "pyz",
            "qml",
            "r",
            "relax-ng",
            "rst",
            "ruby",
            "rust",
            "salt",
            "sass",
            "sbt",
            "scala",
            "scheme",
            "scss",
            "sh",
            "shell",
            "sln",
            "socket",
            "solidity",
            "spec",
            "sql",
            "stylus",
            "svelte",
            "svg",
            "swf",
            "swift",
            "swiftdeps",
            "symlink",
            "system-verilog",
            "tar",
            "tcsh",
            "terraform",
            "tex",
            "text",
            "thrift",
            "tiff",
            "toml",
            "ts",
            "tsv",
            "tsx",
            "ttf",
            "twig",
            "twisted",
            "txsprofile",
            "urdf",
            "vb",
            "vbproj",
            "vcxproj",
            "vdx",
            "verilog",
            "vhdl",
            "vim",
            "vtl",
            "vue",
            "wav",
            "webp",
            "wheel",
            "wkt",
            "woff",
            "woff2",
            "wsgi",
            "xhtml",
            "xml",
            "xquery",
            "xsd",
            "xsl",
            "yaml",
            "yamllint",
            "yang",
            "yin",
            "zcml",
            "zig",
            "zip",
            "zpt",
            "zsh",
        ]
        | str
    ]
):
    root: (
        Literal[
            "adobe-illustrator",
            "alpm",
            "apinotes",
            "asar",
            "asciidoc",
            "ash",
            "asm",
            "aspectj",
            "audio",
            "avif",
            "awk",
            "babelrc",
            "bash",
            "batch",
            "bats",
            "bazel",
            "bazelrc",
            "bib",
            "binary",
            "bitmap",
            "bowerrc",
            "browserslistrc",
            "bzip2",
            "c",
            "c#",
            "c++",
            "c2hs",
            "cbsd",
            "clojure",
            "clojurescript",
            "cmake",
            "codespellrc",
            "coffee",
            "coveragerc",
            "crystal",
            "csh",
            "cson",
            "csproj",
            "css",
            "csslintrc",
            "csv",
            "cuda",
            "cython",
            "dart",
            "dash",
            "def",
            "diff",
            "directory",
            "dockerfile",
            "dockerignore",
            "dotenv",
            "dtd",
            "editorconfig",
            "edn",
            "ejs",
            "eot",
            "eps",
            "erb",
            "executable",
            "expect",
            "file",
            "fish",
            "flake8",
            "gdscript",
            "geojson",
            "gherkin",
            "gif",
            "gitattributes",
            "gitconfig",
            "gitignore",
            "gitlint",
            "gitmodules",
            "go",
            "go-mod",
            "go-sum",
            "gotmpl",
            "gpx",
            "graphql",
            "groovy",
            "gyb",
            "gyp",
            "gzip",
            "handlebars",
            "haskell",
            "hcl",
            "header",
            "hgrc",
            "html",
            "icalendar",
            "icns",
            "icon",
            "idl",
            "idris",
            "image",
            "inc",
            "ini",
            "inl",
            "ino",
            "inx",
            "jade",
            "jar",
            "java",
            "java-properties",
            "javascript",
            "jenkins",
            "jinja",
            "jpeg",
            "jshintrc",
            "json",
            "json5",
            "jsonnet",
            "jsx",
            "jupyter",
            "kml",
            "kotlin",
            "ksh",
            "lean",
            "lektor",
            "lektorproject",
            "less",
            "liquid",
            "literate-haskell",
            "lua",
            "mailmap",
            "makefile",
            "manifest",
            "map",
            "markdown",
            "mdx",
            "mention-bot",
            "meson",
            "mib",
            "modulemap",
            "musescore",
            "myst",
            "ngdoc",
            "nim",
            "nimble",
            "nix",
            "non-executable",
            "npmignore",
            "nunjucks",
            "objective-c",
            "objective-c++",
            "ocaml",
            "otf",
            "p12",
            "pdbrc",
            "pdf",
            "pem",
            "perl",
            "php",
            "pkgbuild",
            "plain-text",
            "plantuml",
            "plist",
            "png",
            "pofile",
            "powershell",
            "prettierignore",
            "prisma",
            "proto",
            "puppet",
            "purescript",
            "pyi",
            "pylintrc",
            "pypirc",
            "pyproj",
            "python",
            "python2",
            "python3",
            "pyz",
            "qml",
            "r",
            "relax-ng",
            "rst",
            "ruby",
            "rust",
            "salt",
            "sass",
            "sbt",
            "scala",
            "scheme",
            "scss",
            "sh",
            "shell",
            "sln",
            "socket",
            "solidity",
            "spec",
            "sql",
            "stylus",
            "svelte",
            "svg",
            "swf",
            "swift",
            "swiftdeps",
            "symlink",
            "system-verilog",
            "tar",
            "tcsh",
            "terraform",
            "tex",
            "text",
            "thrift",
            "tiff",
            "toml",
            "ts",
            "tsv",
            "tsx",
            "ttf",
            "twig",
            "twisted",
            "txsprofile",
            "urdf",
            "vb",
            "vbproj",
            "vcxproj",
            "vdx",
            "verilog",
            "vhdl",
            "vim",
            "vtl",
            "vue",
            "wav",
            "webp",
            "wheel",
            "wkt",
            "woff",
            "woff2",
            "wsgi",
            "xhtml",
            "xml",
            "xquery",
            "xsd",
            "xsl",
            "yaml",
            "yamllint",
            "yang",
            "yin",
            "zcml",
            "zig",
            "zip",
            "zpt",
            "zsh",
        ]
        | str
    )


class FileTypes(RootModel[list[FileType]]):
    root: list[FileType]


class Stage(
    RootModel[
        Literal[
            "commit",
            "merge-commit",
            "push",
            "prepare-commit-msg",
            "commit-msg",
            "post-checkout",
            "post-commit",
            "post-merge",
            "post-rewrite",
            "pre-commit",
            "pre-merge-commit",
            "pre-push",
            "pre-rebase",
            "manual",
        ]
    ]
):
    root: Literal[
        "commit",
        "merge-commit",
        "push",
        "prepare-commit-msg",
        "commit-msg",
        "post-checkout",
        "post-commit",
        "post-merge",
        "post-rewrite",
        "pre-commit",
        "pre-merge-commit",
        "pre-push",
        "pre-rebase",
        "manual",
    ]


class Hook(BaseModel):
    id: Literal["check-hooks-apply", "check-useless-excludes", "identity"]


class MetaRepo(BaseModel):
    repo: Literal["meta"] | None = "meta"
    hooks: list[Hook] | None = None


class Stages(RootModel[list[Stage]]):
    root: list[Stage]


class HookDefinition(BaseModel):
    id: str | None = Field(
        default=None,
        description="An identifier of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    alias: str | None = Field(
        default=None,
        description="An additional identifier of the current hook for `pre-commit run <hookid>`\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    name: str | None = Field(
        default=None,
        description="A name of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    language_version: str | None = Field(
        default=None,
        description="A language version of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    files: str | None = Field(
        default=None,
        description="A pattern to include files to run on of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    exclude: str | None = Field(
        default=None,
        description="A pattern to exclude files from `files` to run on of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    types: FileTypes | None = Field(
        default=None,
        description="A list of file types to run on combined via logical `and` of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    types_or: FileTypes | None = Field(
        default=None,
        description="A list of file types to run on combined via logical `or` of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    exclude_types: FileTypes | None = Field(
        default=None,
        description="A list of file types to exclude of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    args: list[str] | None = Field(
        default=None,
        description="List of additional parameters to pass to the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    stages: Stages | None = Field(
        default=None,
        description="A stage of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    additional_dependencies: list[str] | None = Field(
        default=None,
        description="A list of additional_dependencies of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    always_run: bool | None = Field(
        default=None,
        description="Run the current hook when no files matched\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    verbose: bool | None = Field(
        default=None,
        description="Display an output of the current hook even it passes\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    entry: str | None = Field(
        default=None,
        description="A command of the current hook\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    log_file: str | None = Field(
        default=None, description="A log file of the current hook"
    )
    language: Language | None = Field(
        default=None,
        description="A language the current hook is written in\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    pass_filenames: bool | None = Field(
        default=True,
        description="Whether to pass filenames to the current hook or not\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )
    require_serial: bool | None = Field(
        default=False,
        description="Whether to run the current hook in serial or not\nhttps://pre-commit.com/#pre-commit-configyaml---hooks",
    )


class LocalRepo(BaseModel):
    repo: Literal["local"] | None = Field(
        description="A list of local hooks\nhttps://pre-commit.com/#2-add-a-pre-commit-configuration",
    )
    hooks: list[HookDefinition] | None = None


class UriRepo(BaseModel):
    model_config = ConfigDict(
        regex_engine="python-re",
    )
    repo: str | None = Field(
        default=None,
        description="A repository url\nhttps://pre-commit.com/#2-add-a-pre-commit-configuration",
        pattern="^(?!(?:meta|local)$).*$",
    )
    rev: str | None = Field(
        default=None,
        description="A revision or tag to clone at\nhttps://pre-commit.com/#2-add-a-pre-commit-configuration",
    )
    hooks: list[HookDefinition] | None = Field(
        default=None,
        description="A list of hook mappings\nhttps://pre-commit.com/#pre-commit-configyaml---hooks.",
    )


class JsonSchemaForPreCommitConfigYaml(BaseModel):
    ci: Ci | None = Field(
        default=None,
        description="pre-commit.ci specific settings\nhttps://pre-commit.ci/#configuration",
    )
    repos: list[MetaRepo | LocalRepo | UriRepo] = Field(
        ...,
        description="Repository mappings of the current project\nhttps://pre-commit.com/#pre-commit-configyaml---top-level",
    )
    default_install_hook_types: list | None = Field(
        default=["pre-commit"],
        description="A list of hook types which will be used by default when running `pre-commit install`\nhttps://pre-commit.com/#pre-commit-configyaml---top-level",
    )
    default_language_version: dict[str, str] | None = Field(
        default=None,
        description="Mappings for the default language versions of the current project\nhttps://pre-commit.com/#pre-commit-configyaml---top-level",
    )
    default_stages: Stages | None = Field(
        default=None,
        description="The default stages of the current project\nhttps://pre-commit.com/#pre-commit-configyaml---top-level",
    )
    files: str | None = Field(
        default="",
        description="A file include pattern of the current project\nhttps://pre-commit.com/#pre-commit-configyaml---top-level",
    )
    exclude: str | None = Field(
        default="^$",
        description="A file exclude pattern of the current project\nhttps://pre-commit.com/#pre-commit-configyaml---top-level",
    )
    fail_fast: bool | None = Field(
        default=False,
        description="Whether stop running hooks after a first failure\nhttps://pre-commit.com/#pre-commit-configyaml---top-level",
    )
    minimum_pre_commit_version: str | None = Field(
        default="0",
        description="A minimum version of pre-commit\nhttps://pre-commit.com/#pre-commit-configyaml---top-level",
    )
