// This file is auto-generated by @hey-api/openapi-ts

export type ClientOptions = {
    baseUrl: `${string}://${string}/publishers/seren-skills` | (string & {});
};

export type AcceptUpdateRequestRequest = {
    allow_outdated_base?: boolean | null;
    changelog?: string | null;
    expected_current_version_id?: string | null;
    manifest?: unknown;
    publish_version?: string | null;
};

export type AuthorIdentity = {
    display_name: string;
    git_email: string;
    updated_at: string;
    user_id: string;
};

/**
 * Bundle delta entry on a `CreateVersionRequest`. Path is POSIX,
 * relative to the bundle root, never `SKILL.md` (which is the canonical
 * Markdown column). `content_b64` is base64 of the raw file bytes so
 * binary payloads survive a JSON round-trip; `mode` defaults to 0o100644
 * (0o100755 for files under `scripts/`); `deleted: true` drops the
 * matching path from the new version instead of inserting bytes.
 */
export type BundleFileInput = {
    /**
     * Required unless `deleted` is true.
     */
    content_b64?: string | null;
    deleted?: boolean;
    /**
     * Optional file mode in Git tree mode bits. Defaults to 0o100644.
     */
    mode?: number | null;
    path: string;
};

export type ChatDraftResponse = {
    base_version_id: string;
    created_at: string;
    editor_user_id: string;
    id: string;
    session_id: string;
    skill_id: string;
    status: string;
    updated_at: string;
};

export type Collaborator = {
    granted_at: string;
    granted_by_user_id: string;
    role: string;
    skill_id: string;
    user_id: string;
};

export type CreateCommentRequest = {
    body: string;
};

export type CreateSkillRequest = {
    changelog?: string | null;
    content_doc?: unknown;
    description: string;
    discoverability?: null | SkillDiscoverability;
    /**
     * Optional initial bundle files for the seed version. The first
     * version has no prior carry-over, so these are inserted as the
     * entire non-SKILL.md bundle.
     */
    files?: Array<BundleFileInput> | null;
    frontmatter?: unknown;
    manifest?: unknown;
    name: string;
    owner_kind?: null | SkillOwnerKind;
    price_cents?: number | null;
    publish_now?: boolean | null;
    skill_folder_name?: string | null;
    skill_md?: string | null;
    slug: string;
    sponsor_mode?: null | SkillSponsorMode;
    sponsor_static?: unknown;
    version?: string | null;
    visibility: SkillVisibility;
};

export type CreateUpdateRequest = {
    body: string;
    proposed_content_doc?: unknown;
    proposed_frontmatter?: unknown;
    proposed_skill_md?: string | null;
    title: string;
};

export type CreateVersionRequest = {
    changelog?: string | null;
    content_doc?: unknown;
    expected_current_version_id?: string | null;
    /**
     * Optional bundle deltas. Files supplied here are added to or
     * replaced in the new version's bundle. Files from the prior
     * current version are otherwise carried forward unchanged. Mark
     * `deleted: true` to drop a path; reserve the SKILL.md root path
     * for the canonical Markdown column. See [`BundleFileInput`].
     */
    files?: Array<BundleFileInput> | null;
    frontmatter?: unknown;
    manifest?: unknown;
    session_id?: string | null;
    skill_md?: string | null;
    version: string;
};

export type CreateVersionResponse = {
    draft?: null | ChatDraftResponse;
    merge_state?: null | MergeStateResponse;
    status: string;
    version?: null | SkillVersion;
};

/**
 * `DELETE /skills/{slug}/files/{path...}` body.
 */
export type DeleteFileRequest = {
    expected_current_version_id: string;
    version_label?: string | null;
};

/**
 * Per-file edit response. `unchanged: true` means the resulting
 * bundle hash matches the current version's `content_hash_bundle`
 * and no new version was written; `version` then carries the
 * existing current version. On conflict, `status = "conflict"` and
 * `draft` + `merge_state` come from the standard chat-conflict
 * pipeline reused from `create_version`.
 */
export type FileEditResponse = {
    draft?: null | ChatDraftResponse;
    merge_state?: null | MergeStateResponse;
    status: string;
    unchanged: boolean;
    version?: null | SkillVersion;
};

/**
 * One row in the [`ListFilesResponse`]. `preview` is the first 200
 * chars of the file when it is text; `null` for binaries.
 */
export type FileListing = {
    content_hash: string;
    is_binary: boolean;
    mode: number;
    path: string;
    preview?: string | null;
    size_bytes: number;
};

/**
 * `GET /skills/{slug}/files/{path...}` response: one file's bytes.
 */
export type GetFileResponse = {
    content_b64: string;
    content_hash: string;
    is_binary: boolean;
    mode: number;
    path: string;
    version?: string | null;
};

/**
 * Health of the GitHub mirror for a public/paid skill, as observed by
 * the forward-publish worker. Surfaced on `SkillSummary` so owners see
 * a broken mirror without a separate `/skills/{slug}/github` lookup.
 *
 * - `Pending`: row not yet attempted, or the skill is private and the
 * mirror is intentionally inactive. Default for new skills.
 * - `Healthy`: most recent terminal worker outcome was a successful
 * push.
 * - `Degraded`: reserved for partial-push or transient-failure flows;
 * not currently emitted by the worker but defined so the column is
 * future-proof against a finer-grained health model.
 * - `Failed`: most recent terminal worker outcome exhausted retries
 * without pushing. Owner action required.
 */
export type GithubMirrorHealth = 'pending' | 'healthy' | 'degraded' | 'failed';

export type GithubPublishStatusResponse = {
    commit_sha?: string | null;
    folder_slug: string;
    last_error?: string | null;
    /**
     * Source that supplied `folder_slug` at enqueue time.
     * `"skill"` -> per-skill override (`skills.folder_slug`).
     * `"organization"` -> org default (`skill_org_folders.folder_slug`).
     * Pinned at enqueue rather than recomputed on read because both
     * underlying values can drift after the publish row is written.
     */
    resolved_via: string;
    skill_folder_name: string;
    skill_id: string;
    status: string;
    version_id: string;
};

export type ListCollaboratorsResponse = {
    collaborators: Array<Collaborator>;
};

/**
 * `GET /skills/{slug}/files` response: every path in the current
 * bundle including a synthetic `SKILL.md` entry for completeness.
 */
export type ListFilesResponse = {
    files: Array<FileListing>;
};

export type ListSkillsQuery = {
    limit?: number | null;
    mine?: boolean | null;
    offset?: number | null;
    q?: string | null;
    sort?: null | ListSkillsSort;
    visibility?: null | SkillVisibility;
};

export type ListSkillsResponse = {
    /**
     * True when more pages remain after this one. Equivalent to
     * `offset + skills.len() < total`, exposed so callers (and LLM
     * agents reading SKILL.md) don't have to compute the loop
     * condition themselves.
     */
    has_more: boolean;
    /**
     * The `offset` value to pass on the next request to continue
     * paging, or `None` when the catalog is exhausted.
     */
    next_offset?: number | null;
    skills: Array<SkillSummary>;
    total: number;
};

export type ListSkillsSort = 'updated' | 'installs';

export type ListUpdateRequestCommentsResponse = {
    comments: Array<UpdateRequestComment>;
};

export type ListUpdateRequestsResponse = {
    update_requests: Array<UpdateRequest>;
};

export type ListUsageEventsResponse = {
    events: Array<UsageEvent>;
};

export type ListVersionsResponse = {
    versions: Array<SkillVersion>;
};

export type MergeStateResponse = {
    base_version_id: string;
    chat_draft_id?: string | null;
    conflict_count: number;
    created_at: string;
    editor_user_id: string;
    id: string;
    incoming_version_id: string;
    merged_content_doc: unknown;
    merged_skill_md: string;
    resolved_at?: string | null;
    skill_id: string;
    update_request_id?: string | null;
};

export type OrphanFolderEntry = {
    folder_slug: string;
    /**
     * Every blob path at depth ≥ 3 under `<folder_slug>/<skill_folder_name>/`.
     * Sorted, deduped. Empty `paths` cannot occur — the entry only
     * exists because at least one path matched.
     */
    paths: Array<string>;
    skill_folder_name: string;
};

export type OrphanFoldersResponse = {
    head_commit_sha: string;
    head_tree_sha: string;
    orphan_folders: Array<OrphanFolderEntry>;
};

export type PurchaseResponse = {
    access_granted: boolean;
    charge_id?: string | null;
    purchase_id?: string | null;
    skill_id: string;
    source: string;
};

/**
 * `PUT /skills/{slug}/files/{path...}` body. `expected_content_hash`
 * is the per-file hex SHA from `GET /files`; it is an *optional*
 * pre-flight check that fails fast (409) before the version write.
 * `expected_current_version_id` is forwarded to `create_version`'s
 * existing conflict-draft path -- mismatch returns 409 with a chat
 * draft + merge-state pointer.
 */
export type PutFileRequest = {
    content_b64: string;
    expected_content_hash?: string | null;
    expected_current_version_id: string;
    mode?: number | null;
    /**
     * Optional override for the auto-synthesised
     * `file-edit-<hash>` version label.
     */
    version_label?: string | null;
};

/**
 * Body of `POST /skills/{slug}/github/reconcile-orphans`.
 */
export type ReconcileOrphansRequest = {
    /**
     * Must be `true` -- the handler 409s on `false` or missing. The
     * guard exists so a misconfigured CLI/script cannot quietly
     * delete canonical-repo paths.
     */
    confirm?: boolean;
    /**
     * When true, the handler returns the planned commit shape
     * without touching GitHub. The audit row is still recorded so
     * the operator's preview is auditable.
     */
    dry_run?: boolean;
    /**
     * The orphan-path set the operator computed (e.g. via the
     * `reconcile_canonical_repo` binary). The handler 409s if the
     * live set against canonical HEAD has diverged.
     */
    expected_orphan_paths?: Array<string>;
    /**
     * Optional free-text reason (recorded on the audit row).
     */
    reason?: string | null;
};

export type ResolveConflictRequest = {
    changelog?: string | null;
    content_doc?: unknown;
    frontmatter?: unknown;
    manifest?: unknown;
    resolution_strategy: string;
    skill_md?: string | null;
    version?: string | null;
};

export type SkillAccess = {
    can_download: boolean;
    can_manage: boolean;
    can_view: boolean;
    reason: string;
};

export type SkillBundle = {
    content_hash: string;
    /**
     * Non-SKILL.md files attached to the version. Empty for versions that
     * predate bundle persistence.
     */
    files?: Array<SkillBundleFile>;
    manifest: unknown;
    skill: SkillSummary;
    skill_md: string;
    version: string;
};

export type SkillBundleFile = {
    content_b64: string;
    content_hash: string;
    is_binary: boolean;
    mode: number;
    path: string;
};

/**
 * Single-file body returned by `GET /skills/{slug}/download/file`.
 * Shares the [`SkillBundleFile`] field shape (path + base64 body +
 * per-file hash + mode + is_binary) and adds the bundle `version` so a
 * client can detect a publish that landed between its manifest fetch
 * and this body fetch (version mismatch -> restart from the manifest).
 */
export type SkillBundleFileDownload = {
    content_b64: string;
    content_hash: string;
    is_binary: boolean;
    mode: number;
    path: string;
    version: string;
};

/**
 * Split-download manifest (issue #53): the same envelope as
 * [`SkillBundle`] but every entry in `files` carries *metadata only* —
 * no `content_b64` body. Clients fetch each body separately via
 * `GET /skills/{slug}/download/file?path=...`, keeping every response
 * under the gateway's per-response byte cap even for bundles whose
 * single-shot `/download` JSON would exceed it.
 */
export type SkillBundleManifest = {
    content_hash: string;
    /**
     * Per-file metadata with no bodies. Empty for versions that predate
     * bundle persistence.
     */
    files?: Array<SkillBundleManifestFile>;
    manifest: unknown;
    skill: SkillSummary;
    skill_md: string;
    version: string;
};

/**
 * Body-less per-file metadata returned in a [`SkillBundleManifest`].
 * `size_bytes` is the raw (pre-base64) byte length so clients can show
 * progress and pre-size buffers before fetching each body.
 */
export type SkillBundleManifestFile = {
    content_hash: string;
    is_binary: boolean;
    mode: number;
    path: string;
    size_bytes: number;
};

/**
 * One of `skill_md` (markdown body, server parses to ProseMirror) or
 * `content_doc` + `frontmatter` (editor-native: server renders markdown
 * from the doc and stores both). Exactly one branch must be provided.
 */
export type SkillContentInput = {
    content_doc?: unknown;
    frontmatter?: unknown;
    skill_md?: string | null;
};

export type SkillDetail = SkillSummary & {
    access: SkillAccess;
    latest_version?: null | SkillVersion;
};

export type SkillDiscoverability = 'listed' | 'unlisted';

/**
 * Editor-facing payload: ProseMirror document tree for the rich-text editor
 * plus the parsed frontmatter as JSON. Returned by GET /skills/{slug}/edit
 * and accepted by POST /skills/{slug}/versions when a client wants to write
 * the document directly instead of round-tripping through markdown.
 */
export type SkillEditDocument = {
    content_doc: unknown;
    content_hash?: string | null;
    current_version_id?: string | null;
    frontmatter: unknown;
    skill: SkillSummary;
    version?: string | null;
};

export type SkillOwnerKind = 'user' | 'organization';

export type SkillSponsorMode = 'skip' | 'static' | 'seren_bounty';

export type SkillStatus = 'draft' | 'published' | 'suspended' | 'deleted';

export type SkillSummary = {
    created_at: string;
    created_by_user_id: string;
    current_version?: string | null;
    current_version_id?: string | null;
    deleted_at?: string | null;
    description: string;
    discoverability: SkillDiscoverability;
    /**
     * Per-skill override for the GitHub mirror folder. When set, takes
     * precedence over `skill_org_folders.folder_slug`. `None` means
     * fall through to the org default. See migration 009 + issue #17.
     */
    folder_slug?: string | null;
    github_mirror_health: GithubMirrorHealth;
    id: string;
    install_count: number;
    name: string;
    owner_kind: SkillOwnerKind;
    owner_organization_id: string;
    owner_user_id?: string | null;
    price_cents: number;
    seren_bounty_campaign_id?: string | null;
    skill_folder_name: string;
    slug: string;
    sponsor_mode: SkillSponsorMode;
    sponsor_referral_code?: string | null;
    sponsor_static?: unknown;
    status: SkillStatus;
    updated_at: string;
    visibility: SkillVisibility;
};

export type SkillVersion = {
    changelog?: string | null;
    content_hash: string;
    created_at: string;
    created_by_user_id: string;
    id: string;
    manifest: unknown;
    review_status: string;
    skill_id: string;
    version: string;
};

export type SkillVisibility = 'private' | 'public' | 'paid';

export type TransferOrgFolderRequest = {
    display_name?: string | null;
    folder_slug: string;
};

export type UpdateRequest = {
    base_version_id?: string | null;
    body: string;
    created_at: string;
    id: string;
    proposed_content_hash?: string | null;
    proposer_user_id: string;
    skill_id: string;
    status: string;
    title: string;
    updated_at: string;
};

export type UpdateRequestComment = {
    author_user_id: string;
    body: string;
    created_at: string;
    id: string;
    request_id: string;
};

export type UpdateRequestDetail = UpdateRequest & {
    base_version?: null | SkillVersion;
    proposed_content_doc?: unknown;
    proposed_frontmatter?: unknown;
    proposed_skill_md?: string | null;
    skill: SkillSummary;
};

export type UpdateRequestDiff = {
    base_skill_md?: string | null;
    base_version_id?: string | null;
    current_version_id?: string | null;
    is_outdated: boolean;
    proposed_skill_md?: string | null;
    request_id: string;
};

export type UpdateSkillRequest = {
    description?: string | null;
    discoverability?: null | SkillDiscoverability;
    /**
     * Per-skill GitHub mirror folder override. Three-state field:
     * field absent → no change; explicit `null` → clear the override
     * (fall back to org default); string → set the override.
     * See issue #17.
     */
    folder_slug?: string | null;
    name?: string | null;
    price_cents?: number | null;
    status?: null | SkillStatus;
    visibility?: null | SkillVisibility;
};

export type UpdateSponsorRequest = {
    sponsor_mode: SkillSponsorMode;
    sponsor_static?: unknown;
};

export type UpsertAuthorIdentityRequest = {
    display_name: string;
    git_email: string;
};

export type UpsertCollaboratorRequest = {
    role: string;
    user_id: string;
};

export type UpsertOrgFolderRequest = {
    display_name?: string | null;
    folder_slug: string;
};

export type UsageEvent = {
    amount_atomic: number;
    billing_charge_id?: string | null;
    billing_status: string;
    created_at: string;
    event_type: string;
    id: string;
    organization_id: string;
    skill_id?: string | null;
    units: number;
    user_id: string;
};

export type UsageSummaryResponse = {
    month: string;
    note: string;
    rows: Array<UsageSummaryRow>;
    total_amount_atomic: number;
};

export type UsageSummaryRow = {
    amount_atomic: number;
    event_type: string;
    units: number;
};

export type PublisherRootData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/';
};

export type PublisherRootResponses = {
    /**
     * Publisher metadata
     */
    200: {
        [key: string]: unknown;
    };
};

export type PublisherRootResponse = PublisherRootResponses[keyof PublisherRootResponses];

export type ListOrphanFoldersData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/admin/skills/orphan-folders';
};

export type ListOrphanFoldersErrors = {
    /**
     * Caller lacks platform admin role
     */
    403: unknown;
};

export type ListOrphanFoldersResponses = {
    /**
     * Operator orphan-folders inventory
     */
    200: OrphanFoldersResponse;
};

export type ListOrphanFoldersResponse = ListOrphanFoldersResponses[keyof ListOrphanFoldersResponses];

export type GetAuthorIdentityData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/git-identity';
};

export type GetAuthorIdentityResponses = {
    /**
     * Git author identity
     */
    200: AuthorIdentity;
};

export type GetAuthorIdentityResponse = GetAuthorIdentityResponses[keyof GetAuthorIdentityResponses];

export type UpsertAuthorIdentityData = {
    body: UpsertAuthorIdentityRequest;
    path?: never;
    query?: never;
    url: '/git-identity';
};

export type UpsertAuthorIdentityResponses = {
    /**
     * Upserted Git author identity
     */
    200: AuthorIdentity;
};

export type UpsertAuthorIdentityResponse = UpsertAuthorIdentityResponses[keyof UpsertAuthorIdentityResponses];

export type GetOrgFolderData = {
    body?: never;
    path: {
        /**
         * Organization ID
         */
        org_id: string;
    };
    query?: never;
    url: '/organizations/{org_id}/folder';
};

export type GetOrgFolderResponses = {
    /**
     * Organization folder
     */
    200: {
        [key: string]: unknown;
    };
};

export type GetOrgFolderResponse = GetOrgFolderResponses[keyof GetOrgFolderResponses];

export type UpdateOrgFolderData = {
    body: UpsertOrgFolderRequest;
    path: {
        /**
         * Organization ID
         */
        org_id: string;
    };
    query?: never;
    url: '/organizations/{org_id}/folder';
};

export type UpdateOrgFolderResponses = {
    /**
     * Organization folder
     */
    200: {
        [key: string]: unknown;
    };
};

export type UpdateOrgFolderResponse = UpdateOrgFolderResponses[keyof UpdateOrgFolderResponses];

export type CreateOrgFolderData = {
    body: UpsertOrgFolderRequest;
    path: {
        /**
         * Organization ID
         */
        org_id: string;
    };
    query?: never;
    url: '/organizations/{org_id}/folder';
};

export type CreateOrgFolderResponses = {
    /**
     * Organization folder
     */
    200: {
        [key: string]: unknown;
    };
};

export type CreateOrgFolderResponse = CreateOrgFolderResponses[keyof CreateOrgFolderResponses];

export type ReplaceOrgFolderData = {
    body: UpsertOrgFolderRequest;
    path: {
        /**
         * Organization ID
         */
        org_id: string;
    };
    query?: never;
    url: '/organizations/{org_id}/folder';
};

export type ReplaceOrgFolderResponses = {
    /**
     * Organization folder
     */
    200: {
        [key: string]: unknown;
    };
};

export type ReplaceOrgFolderResponse = ReplaceOrgFolderResponses[keyof ReplaceOrgFolderResponses];

export type TransferOrgFolderData = {
    body: TransferOrgFolderRequest;
    path: {
        /**
         * Organization ID
         */
        org_id: string;
    };
    query?: never;
    url: '/organizations/{org_id}/folder/transfer';
};

export type TransferOrgFolderErrors = {
    /**
     * Caller is not org-admin, personal-owner of {org_id}, or platform admin
     */
    403: unknown;
    /**
     * Slug is not held by any folder row
     */
    404: unknown;
    /**
     * Slug is held by a real organization, not a placeholder
     */
    409: unknown;
};

export type TransferOrgFolderResponses = {
    /**
     * Organization folder
     */
    200: {
        [key: string]: unknown;
    };
};

export type TransferOrgFolderResponse = TransferOrgFolderResponses[keyof TransferOrgFolderResponses];

export type SkillMdData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/skill.md';
};

export type SkillMdResponses = {
    /**
     * Publisher skill definition
     */
    200: unknown;
};

export type ListSkillsData = {
    body?: never;
    path?: never;
    query?: {
        q?: string | null;
        visibility?: null | SkillVisibility;
        mine?: boolean | null;
        sort?: null | ListSkillsSort;
        limit?: number | null;
        offset?: number | null;
    };
    url: '/skills';
};

export type ListSkillsResponses = {
    /**
     * Skills
     */
    200: ListSkillsResponse;
};

export type ListSkillsResponse2 = ListSkillsResponses[keyof ListSkillsResponses];

export type CreateSkillData = {
    body: CreateSkillRequest;
    path?: never;
    query?: never;
    url: '/skills';
};

export type CreateSkillResponses = {
    /**
     * Created skill
     */
    200: SkillDetail;
};

export type CreateSkillResponse = CreateSkillResponses[keyof CreateSkillResponses];

export type DeleteSkillData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}';
};

export type DeleteSkillResponses = {
    /**
     * Soft-deleted skill
     */
    200: {
        [key: string]: unknown;
    };
};

export type DeleteSkillResponse = DeleteSkillResponses[keyof DeleteSkillResponses];

export type GetSkillData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}';
};

export type GetSkillResponses = {
    /**
     * Skill detail
     */
    200: SkillDetail;
};

export type GetSkillResponse = GetSkillResponses[keyof GetSkillResponses];

export type UpdateSkillData = {
    body: UpdateSkillRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}';
};

export type UpdateSkillResponses = {
    /**
     * Updated skill
     */
    200: SkillDetail;
};

export type UpdateSkillResponse = UpdateSkillResponses[keyof UpdateSkillResponses];

export type ListCollaboratorsData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/collaborators';
};

export type ListCollaboratorsResponses = {
    /**
     * Skill collaborators
     */
    200: ListCollaboratorsResponse;
};

export type ListCollaboratorsResponse2 = ListCollaboratorsResponses[keyof ListCollaboratorsResponses];

export type DeleteCollaboratorData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Collaborator user ID
         */
        user_id: string;
    };
    query?: never;
    url: '/skills/{slug}/collaborators/{user_id}';
};

export type DeleteCollaboratorResponses = {
    /**
     * Deleted collaborator
     */
    200: {
        [key: string]: unknown;
    };
};

export type DeleteCollaboratorResponse = DeleteCollaboratorResponses[keyof DeleteCollaboratorResponses];

export type UpsertCollaboratorData = {
    body: UpsertCollaboratorRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Collaborator user ID
         */
        user_id: string;
    };
    query?: never;
    url: '/skills/{slug}/collaborators/{user_id}';
};

export type UpsertCollaboratorResponses = {
    /**
     * Upserted collaborator
     */
    200: Collaborator;
};

export type UpsertCollaboratorResponse = UpsertCollaboratorResponses[keyof UpsertCollaboratorResponses];

export type DownloadSkillData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/download';
};

export type DownloadSkillResponses = {
    /**
     * Downloadable skill bundle
     */
    200: SkillBundle;
};

export type DownloadSkillResponse = DownloadSkillResponses[keyof DownloadSkillResponses];

export type DownloadSkillFileData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query: {
        /**
         * Bundle-relative file path from the manifest
         */
        path: string;
    };
    url: '/skills/{slug}/download/file';
};

export type DownloadSkillFileResponses = {
    /**
     * One bundle file body
     */
    200: SkillBundleFileDownload;
};

export type DownloadSkillFileResponse = DownloadSkillFileResponses[keyof DownloadSkillFileResponses];

export type DownloadSkillManifestData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/download/manifest';
};

export type DownloadSkillManifestResponses = {
    /**
     * Bundle manifest without file bodies
     */
    200: SkillBundleManifest;
};

export type DownloadSkillManifestResponse = DownloadSkillManifestResponses[keyof DownloadSkillManifestResponses];

export type GetDraftData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Draft ID
         */
        draft_id: string;
    };
    query?: never;
    url: '/skills/{slug}/drafts/{draft_id}';
};

export type GetDraftResponses = {
    /**
     * Chat conflict draft
     */
    200: ChatDraftResponse;
};

export type GetDraftResponse = GetDraftResponses[keyof GetDraftResponses];

export type GetMergeStateData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Draft ID
         */
        draft_id: string;
    };
    query?: never;
    url: '/skills/{slug}/drafts/{draft_id}/merge-state';
};

export type GetMergeStateResponses = {
    /**
     * Merge state
     */
    200: MergeStateResponse;
};

export type GetMergeStateResponse = GetMergeStateResponses[keyof GetMergeStateResponses];

export type ResolveConflictData = {
    body: ResolveConflictRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Draft ID
         */
        draft_id: string;
    };
    query?: never;
    url: '/skills/{slug}/drafts/{draft_id}/resolve-conflict';
};

export type ResolveConflictResponses = {
    /**
     * Resolved conflict version
     */
    200: CreateVersionResponse;
};

export type ResolveConflictResponse = ResolveConflictResponses[keyof ResolveConflictResponses];

export type GetSkillEditDocumentData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/edit';
};

export type GetSkillEditDocumentErrors = {
    /**
     * Owner access required
     */
    403: unknown;
};

export type GetSkillEditDocumentResponses = {
    /**
     * Editor-facing document
     */
    200: SkillEditDocument;
};

export type GetSkillEditDocumentResponse = GetSkillEditDocumentResponses[keyof GetSkillEditDocumentResponses];

export type ListFilesData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/files';
};

export type ListFilesResponses = {
    /**
     * Bundle file listing
     */
    200: ListFilesResponse;
};

export type ListFilesResponse2 = ListFilesResponses[keyof ListFilesResponses];

export type DeleteFileData = {
    body: DeleteFileRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Bundle path; SKILL.md is rejected with 400
         */
        path: string;
    };
    query?: never;
    url: '/skills/{slug}/files/{path}';
};

export type DeleteFileResponses = {
    /**
     * Per-file delete result
     */
    200: FileEditResponse;
};

export type DeleteFileResponse = DeleteFileResponses[keyof DeleteFileResponses];

export type GetFileData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Bundle path or 'SKILL.md'
         */
        path: string;
    };
    query?: never;
    url: '/skills/{slug}/files/{path}';
};

export type GetFileResponses = {
    /**
     * Single bundle file
     */
    200: GetFileResponse;
};

export type GetFileResponse2 = GetFileResponses[keyof GetFileResponses];

export type PutFileData = {
    body: PutFileRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Bundle path or 'SKILL.md'
         */
        path: string;
    };
    query?: never;
    url: '/skills/{slug}/files/{path}';
};

export type PutFileResponses = {
    /**
     * Per-file edit result
     */
    200: FileEditResponse;
};

export type PutFileResponse = PutFileResponses[keyof PutFileResponses];

export type GithubStatusData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/github';
};

export type GithubStatusResponses = {
    /**
     * GitHub publish ledger
     */
    200: {
        [key: string]: unknown;
    };
};

export type GithubStatusResponse = GithubStatusResponses[keyof GithubStatusResponses];

export type ReconcileOrphansData = {
    body: ReconcileOrphansRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/github/reconcile-orphans';
};

export type ReconcileOrphansErrors = {
    /**
     * Mismatch or unconfirmed request
     */
    409: {
        [key: string]: unknown;
    };
};

export type ReconcileOrphansError = ReconcileOrphansErrors[keyof ReconcileOrphansErrors];

export type ReconcileOrphansResponses = {
    /**
     * Reconcile result
     */
    200: {
        [key: string]: unknown;
    };
};

export type ReconcileOrphansResponse = ReconcileOrphansResponses[keyof ReconcileOrphansResponses];

export type RetryGithubPublishData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/github/retry';
};

export type RetryGithubPublishResponses = {
    /**
     * GitHub publish retry queued
     */
    200: {
        [key: string]: unknown;
    };
};

export type RetryGithubPublishResponse = RetryGithubPublishResponses[keyof RetryGithubPublishResponses];

export type SyncFromMainData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/github/sync-from-main';
};

export type SyncFromMainResponses = {
    /**
     * GitHub sync-from-main result
     */
    200: {
        [key: string]: unknown;
    };
};

export type SyncFromMainResponse = SyncFromMainResponses[keyof SyncFromMainResponses];

export type PurchaseSkillData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/purchase';
};

export type PurchaseSkillErrors = {
    /**
     * Insufficient balance
     */
    402: unknown;
};

export type PurchaseSkillResponses = {
    /**
     * Purchase result
     */
    200: PurchaseResponse;
};

export type PurchaseSkillResponse = PurchaseSkillResponses[keyof PurchaseSkillResponses];

export type UpdateSponsorData = {
    body: UpdateSponsorRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/sponsor';
};

export type UpdateSponsorResponses = {
    /**
     * Updated sponsor settings
     */
    200: SkillDetail;
};

export type UpdateSponsorResponse = UpdateSponsorResponses[keyof UpdateSponsorResponses];

export type ListUpdateRequestsData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/update-requests';
};

export type ListUpdateRequestsResponses = {
    /**
     * Update requests
     */
    200: ListUpdateRequestsResponse;
};

export type ListUpdateRequestsResponse2 = ListUpdateRequestsResponses[keyof ListUpdateRequestsResponses];

export type CreateUpdateRequestData = {
    body: CreateUpdateRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/update-requests';
};

export type CreateUpdateRequestResponses = {
    /**
     * Created update request
     */
    200: UpdateRequest;
};

export type CreateUpdateRequestResponse = CreateUpdateRequestResponses[keyof CreateUpdateRequestResponses];

export type ListVersionsData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/versions';
};

export type ListVersionsResponses = {
    /**
     * Skill versions
     */
    200: ListVersionsResponse;
};

export type ListVersionsResponse2 = ListVersionsResponses[keyof ListVersionsResponses];

export type CreateVersionData = {
    body: CreateVersionRequest;
    path: {
        /**
         * Skill slug
         */
        slug: string;
    };
    query?: never;
    url: '/skills/{slug}/versions';
};

export type CreateVersionResponses = {
    /**
     * Created skill version or conflict draft
     */
    200: CreateVersionResponse;
};

export type CreateVersionResponse2 = CreateVersionResponses[keyof CreateVersionResponses];

export type GetVersionManifestData = {
    body?: never;
    path: {
        /**
         * Skill slug
         */
        slug: string;
        /**
         * Version string
         */
        version: string;
    };
    query?: never;
    url: '/skills/{slug}/versions/{version}/manifest';
};

export type GetVersionManifestResponses = {
    /**
     * Version manifest
     */
    200: {
        [key: string]: unknown;
    };
};

export type GetVersionManifestResponse = GetVersionManifestResponses[keyof GetVersionManifestResponses];

export type GetUpdateRequestData = {
    body?: never;
    path: {
        /**
         * Update request ID
         */
        request_id: string;
    };
    query?: never;
    url: '/update-requests/{request_id}';
};

export type GetUpdateRequestResponses = {
    /**
     * Update request detail
     */
    200: UpdateRequestDetail;
};

export type GetUpdateRequestResponse = GetUpdateRequestResponses[keyof GetUpdateRequestResponses];

export type AcceptUpdateRequestData = {
    body: AcceptUpdateRequestRequest;
    path: {
        /**
         * Update request ID
         */
        request_id: string;
    };
    query?: never;
    url: '/update-requests/{request_id}/accept';
};

export type AcceptUpdateRequestResponses = {
    /**
     * Accepted update request
     */
    200: UpdateRequest;
};

export type AcceptUpdateRequestResponse = AcceptUpdateRequestResponses[keyof AcceptUpdateRequestResponses];

export type ListUpdateRequestCommentsData = {
    body?: never;
    path: {
        /**
         * Update request ID
         */
        request_id: string;
    };
    query?: never;
    url: '/update-requests/{request_id}/comments';
};

export type ListUpdateRequestCommentsResponses = {
    /**
     * Update request comments
     */
    200: ListUpdateRequestCommentsResponse;
};

export type ListUpdateRequestCommentsResponse2 = ListUpdateRequestCommentsResponses[keyof ListUpdateRequestCommentsResponses];

export type CreateUpdateRequestCommentData = {
    body: CreateCommentRequest;
    path: {
        /**
         * Update request ID
         */
        request_id: string;
    };
    query?: never;
    url: '/update-requests/{request_id}/comments';
};

export type CreateUpdateRequestCommentResponses = {
    /**
     * Created comment
     */
    200: {
        [key: string]: unknown;
    };
};

export type CreateUpdateRequestCommentResponse = CreateUpdateRequestCommentResponses[keyof CreateUpdateRequestCommentResponses];

export type GetUpdateRequestDiffData = {
    body?: never;
    path: {
        /**
         * Update request ID
         */
        request_id: string;
    };
    query?: never;
    url: '/update-requests/{request_id}/diff';
};

export type GetUpdateRequestDiffResponses = {
    /**
     * Update request diff payload
     */
    200: UpdateRequestDiff;
};

export type GetUpdateRequestDiffResponse = GetUpdateRequestDiffResponses[keyof GetUpdateRequestDiffResponses];

export type RejectUpdateRequestData = {
    body?: never;
    path: {
        /**
         * Update request ID
         */
        request_id: string;
    };
    query?: never;
    url: '/update-requests/{request_id}/reject';
};

export type RejectUpdateRequestResponses = {
    /**
     * Rejected update request
     */
    200: UpdateRequest;
};

export type RejectUpdateRequestResponse = RejectUpdateRequestResponses[keyof RejectUpdateRequestResponses];

export type ListUsageEventsData = {
    body?: never;
    path?: never;
    query?: {
        limit?: number | null;
        offset?: number | null;
    };
    url: '/usage';
};

export type ListUsageEventsResponses = {
    /**
     * Usage events
     */
    200: ListUsageEventsResponse;
};

export type ListUsageEventsResponse2 = ListUsageEventsResponses[keyof ListUsageEventsResponses];

export type UsageSummaryData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/usage/summary';
};

export type UsageSummaryResponses = {
    /**
     * Current-month usage totals
     */
    200: UsageSummaryResponse;
};

export type UsageSummaryResponse2 = UsageSummaryResponses[keyof UsageSummaryResponses];
