# Generated by cloudcoil-model-codegen v0.0.17
# DO NOT EDIT

from __future__ import annotations

from typing import Annotated, List, Literal, Optional

from pydantic import Field

from cloudcoil import apimachinery
from cloudcoil._pydantic import BaseModel
from cloudcoil.resources import Resource, ResourceList


class GroupVersionResource(BaseModel):
    group: Annotated[Optional[str], Field(description="The name of the group.")] = None
    resource: Annotated[Optional[str], Field(description="The name of the resource.")] = None
    version: Annotated[Optional[str], Field(description="The name of the version.")] = None


class StorageVersionMigrationSpec(BaseModel):
    continue_token: Annotated[
        Optional[str],
        Field(
            alias="continueToken",
            description='The token used in the list options to get the next chunk of objects to migrate. When the .status.conditions indicates the migration is "Running", users can use this token to check the progress of the migration.',
        ),
    ] = None
    resource: Annotated[
        GroupVersionResource,
        Field(
            description="The resource that is being migrated. The migrator sends requests to the endpoint serving the resource. Immutable."
        ),
    ]


class MigrationCondition(BaseModel):
    last_update_time: Annotated[
        Optional[apimachinery.Time],
        Field(
            alias="lastUpdateTime",
            description="The last time this condition was updated.",
        ),
    ] = None
    message: Annotated[
        Optional[str],
        Field(description="A human readable message indicating details about the transition."),
    ] = None
    reason: Annotated[
        Optional[str],
        Field(description="The reason for the condition's last transition."),
    ] = None
    status: Annotated[
        str, Field(description="Status of the condition, one of True, False, Unknown.")
    ]
    type: Annotated[str, Field(description="Type of the condition.")]


class StorageVersionMigrationStatus(BaseModel):
    conditions: Annotated[
        Optional[List[MigrationCondition]],
        Field(description="The latest available observations of the migration's current state."),
    ] = None
    resource_version: Annotated[
        Optional[str],
        Field(
            alias="resourceVersion",
            description="ResourceVersion to compare with the GC cache for performing the migration. This is the current resource version of given group, version and resource when kube-controller-manager first observes this StorageVersionMigration resource.",
        ),
    ] = None


class StorageVersionMigration(Resource):
    api_version: Annotated[
        Optional[Literal["storagemigration.k8s.io/v1alpha1"]],
        Field(
            alias="apiVersion",
            description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
        ),
    ] = "storagemigration.k8s.io/v1alpha1"
    kind: Annotated[
        Optional[Literal["StorageVersionMigration"]],
        Field(
            description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
        ),
    ] = "StorageVersionMigration"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta],
        Field(
            description="Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
        ),
    ] = None
    spec: Annotated[
        Optional[StorageVersionMigrationSpec],
        Field(description="Specification of the migration."),
    ] = None
    status: Annotated[
        Optional[StorageVersionMigrationStatus],
        Field(description="Status of the migration."),
    ] = None


StorageVersionMigrationList = ResourceList["StorageVersionMigration"]
