import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { RepositoryCombobox } from './feature-create-drawer.js';
const SAMPLE_REPOSITORIES = [
    { id: 'repo-001', name: 'my-app', path: '/Users/dev/projects/my-app' },
    { id: 'repo-002', name: 'api-service', path: '/Users/dev/projects/api-service' },
    { id: 'repo-003', name: 'shared-lib', path: '/Users/dev/libs/shared-lib' },
    { id: 'repo-004', name: 'docs-site', path: '/Users/dev/projects/docs-site' },
];
const REPOS_WITH_FORKS = [
    { id: 'repo-001', name: 'my-app', path: '/Users/dev/projects/my-app' },
    {
        id: 'repo-002',
        name: 'api-service',
        path: '/Users/dev/projects/api-service',
        isFork: true,
        upstreamUrl: 'https://github.com/upstream-org/api-service',
    },
    { id: 'repo-003', name: 'shared-lib', path: '/Users/dev/libs/shared-lib' },
    {
        id: 'repo-004',
        name: 'open-source-tool',
        path: '/Users/dev/projects/open-source-tool',
        isFork: true,
        upstreamUrl: 'https://github.com/community/open-source-tool',
    },
];
const meta = {
    title: 'Drawers/Feature/RepositoryCombobox',
    component: RepositoryCombobox,
    tags: ['autodocs'],
    parameters: {
        layout: 'centered',
    },
};
export default meta;
function RepositoryComboboxWrapper({ repositories: initialRepos, initialValue, disabled, }) {
    const [repos, setRepos] = useState(initialRepos);
    const [value, setValue] = useState(initialValue);
    return (_jsxs("div", { className: "w-80", children: [_jsx(RepositoryCombobox, { repositories: repos, value: value, onChange: setValue, onAddRepository: (repo) => {
                    setRepos((prev) => [...prev, repo]);
                    setValue(repo.path);
                }, disabled: disabled }), value ? _jsxs("p", { className: "text-muted-foreground mt-2 text-xs", children: ["Selected: ", value] }) : null] }));
}
/** Default state with multiple repositories available for selection. */
export const WithRepositories = {
    render: () => _jsx(RepositoryComboboxWrapper, { repositories: SAMPLE_REPOSITORIES }),
};
/** Empty list — shows "No repositories found." message and "Add new repository..." option. */
export const EmptyList = {
    render: () => _jsx(RepositoryComboboxWrapper, { repositories: [] }),
};
/** Pre-selected repository — trigger button shows the selected repo name. */
export const PreSelected = {
    render: () => (_jsx(RepositoryComboboxWrapper, { repositories: SAMPLE_REPOSITORIES, initialValue: "/Users/dev/projects/api-service" })),
};
/** Disabled state — combobox trigger button is non-interactive. */
export const Disabled = {
    render: () => _jsx(RepositoryComboboxWrapper, { repositories: SAMPLE_REPOSITORIES, disabled: true }),
};
/** Repositories with fork badges — forked repos show a "Fork" badge next to their name. */
export const WithForkBadges = {
    render: () => _jsx(RepositoryComboboxWrapper, { repositories: REPOS_WITH_FORKS }),
};
