"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from dub.types import BaseModel, Nullable, UNSET_SENTINEL
from dub.utils import FieldMetadata, PathParamMetadata, RequestMetadata
from enum import Enum
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class RejectionReason(str, Enum):
    r"""The reason for rejecting the submission."""

    INVALID_PROOF = "invalidProof"
    DUPLICATE_SUBMISSION = "duplicateSubmission"
    OUT_OF_TIME_WINDOW = "outOfTimeWindow"
    DID_NOT_MEET_CRITERIA = "didNotMeetCriteria"
    OTHER = "other"


class RejectBountySubmissionRequestBodyTypedDict(TypedDict):
    rejection_reason: NotRequired[RejectionReason]
    r"""The reason for rejecting the submission."""
    rejection_note: NotRequired[str]
    r"""The note for rejecting the submission."""


class RejectBountySubmissionRequestBody(BaseModel):
    rejection_reason: Annotated[
        Optional[RejectionReason], pydantic.Field(alias="rejectionReason")
    ] = None
    r"""The reason for rejecting the submission."""

    rejection_note: Annotated[Optional[str], pydantic.Field(alias="rejectionNote")] = (
        None
    )
    r"""The note for rejecting the submission."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["rejectionReason", "rejectionNote"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class RejectBountySubmissionRequestTypedDict(TypedDict):
    bounty_id: str
    r"""The ID of the bounty"""
    submission_id: str
    r"""The ID of the bounty submission"""
    request_body: NotRequired[RejectBountySubmissionRequestBodyTypedDict]


class RejectBountySubmissionRequest(BaseModel):
    bounty_id: Annotated[
        str,
        pydantic.Field(alias="bountyId"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]
    r"""The ID of the bounty"""

    submission_id: Annotated[
        str,
        pydantic.Field(alias="submissionId"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]
    r"""The ID of the bounty submission"""

    request_body: Annotated[
        Optional[RejectBountySubmissionRequestBody],
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["RequestBody"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class RejectBountySubmissionFilesTypedDict(TypedDict):
    url: str
    r"""The URL of the uploaded file."""
    file_name: str
    r"""The original file name."""
    size: float
    r"""The file size in bytes."""


class RejectBountySubmissionFiles(BaseModel):
    url: str
    r"""The URL of the uploaded file."""

    file_name: Annotated[str, pydantic.Field(alias="fileName")]
    r"""The original file name."""

    size: float
    r"""The file size in bytes."""


class RejectBountySubmissionStatus(str, Enum):
    r"""The status of the submission"""

    DRAFT = "draft"
    SUBMITTED = "submitted"
    APPROVED = "approved"
    REJECTED = "rejected"


class RejectBountySubmissionResponseBodyTypedDict(TypedDict):
    r"""The rejected bounty submission."""

    id: str
    r"""The ID of the bounty submission"""
    bounty_id: str
    r"""The ID of the bounty"""
    partner_id: str
    r"""The ID of the partner"""
    description: Nullable[str]
    r"""The description of the submission"""
    urls: Nullable[List[str]]
    r"""The URLs submitted for the submission"""
    files: Nullable[List[RejectBountySubmissionFilesTypedDict]]
    r"""The files uploaded for the submission"""
    status: RejectBountySubmissionStatus
    r"""The status of the submission"""
    performance_count: Nullable[float]
    r"""The performance count of the submission"""
    created_at: str
    r"""The date and time the submission was created"""
    completed_at: Nullable[str]
    r"""The date and time the submission was completed"""
    reviewed_at: Nullable[str]
    r"""The date and time the submission was reviewed"""
    rejection_reason: Nullable[str]
    r"""The reason for rejecting the submission"""
    rejection_note: Nullable[str]
    r"""The note for rejecting the submission"""


class RejectBountySubmissionResponseBody(BaseModel):
    r"""The rejected bounty submission."""

    id: str
    r"""The ID of the bounty submission"""

    bounty_id: Annotated[str, pydantic.Field(alias="bountyId")]
    r"""The ID of the bounty"""

    partner_id: Annotated[str, pydantic.Field(alias="partnerId")]
    r"""The ID of the partner"""

    description: Nullable[str]
    r"""The description of the submission"""

    urls: Nullable[List[str]]
    r"""The URLs submitted for the submission"""

    files: Nullable[List[RejectBountySubmissionFiles]]
    r"""The files uploaded for the submission"""

    status: RejectBountySubmissionStatus
    r"""The status of the submission"""

    performance_count: Annotated[
        Nullable[float], pydantic.Field(alias="performanceCount")
    ]
    r"""The performance count of the submission"""

    created_at: Annotated[str, pydantic.Field(alias="createdAt")]
    r"""The date and time the submission was created"""

    completed_at: Annotated[Nullable[str], pydantic.Field(alias="completedAt")]
    r"""The date and time the submission was completed"""

    reviewed_at: Annotated[Nullable[str], pydantic.Field(alias="reviewedAt")]
    r"""The date and time the submission was reviewed"""

    rejection_reason: Annotated[Nullable[str], pydantic.Field(alias="rejectionReason")]
    r"""The reason for rejecting the submission"""

    rejection_note: Annotated[Nullable[str], pydantic.Field(alias="rejectionNote")]
    r"""The note for rejecting the submission"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                m[k] = val

        return m
