# Generated by ariadne-codegen
# Source: api/graph/schema.graphqls

from typing import Optional

from pydantic import Field

from .base_model import BaseModel
from .enums import Visibility, WebhookEvent


class Filter(BaseModel):
    count: Optional[int] = 20
    "Number of results to return."
    search: Optional[str] = None
    "Search terms. The exact meaning varies by usage, but generally these are\ncompatible with the web UI's search syntax."


class RepoInput(BaseModel):
    name: Optional[str] = None
    description: Optional[str] = None
    visibility: Optional[Visibility] = None
    readme: Optional[str] = None
    "Updates the custom README associated with this repository. Note that the\nprovided HTML will be sanitized when displayed on the web; see\nhttps://man.sr.ht/markdown/#post-processing"
    head: Optional[str] = Field(alias="HEAD", default=None)
    "Updates the repository HEAD reference, which serves as the default branch.\nMust be a valid branch name."


class UserWebhookInput(BaseModel):
    url: str
    events: list[WebhookEvent]
    query: str


class GitWebhookInput(BaseModel):
    repository_id: int = Field(alias="repositoryID")
    url: str
    events: list[WebhookEvent]
    query: str


class UpdatedRefInput(BaseModel):
    ref: str
    old: str
    new: str


class GitEventInput(BaseModel):
    repository_id: int = Field(alias="repositoryID")
    event: WebhookEvent
    updates: list[Optional["UpdatedRefInput"]]


GitEventInput.model_rebuild()
