/**
 * Code Connect — Switch / Checkbox / Radio / Divider
 * Figma 文件：0zsTetwqRuSKJRsyJJXcjg（Desktop Library）
 */

import figma from '@figma/code-connect';
import { Switch   } from './src/components/Switch/Switch';
import { Checkbox } from './src/components/Checkbox/Checkbox';
import { Radio    } from './src/components/Radio/Radio';
import { Divider  } from './src/components/Divider/Divider';

// ── Switch ──────────────────────────────────────
figma.connect(Switch, 'figma://file/0zsTetwqRuSKJRsyJJXcjg?node-id=1258:5770', {
  props: {
    checked: figma.enum('State', {
      'On Normal':  true,
      'On Hover':   true,
      'Off Normal': false,
      'Off Hover':  false,
    }),
    disabled: figma.enum('State', {
      Disabled: true,
    }),
  },
  example: ({ checked, disabled }) => (
    <Switch checked={checked} disabled={disabled} />
  ),
});

// ── Checkbox ────────────────────────────────────
figma.connect(Checkbox, 'figma://file/0zsTetwqRuSKJRsyJJXcjg?node-id=1258:5695', {
  props: {
    checked: figma.enum('Selection', {
      Selected:      true,
      Unselected:    false,
      Indeterminate: false,
    }),
    indeterminate: figma.enum('Selection', {
      Indeterminate: true,
      Selected:      false,
      Unselected:    false,
    }),
    disabled: figma.enum('State', {
      Disabled: true,
      Normal:   false,
      Hover:    false,
      Pressed:  false,
    }),
  },
  example: ({ checked, indeterminate, disabled }) => (
    <Checkbox
      checked={checked}
      indeterminate={indeterminate}
      disabled={disabled}
    />
  ),
});

// ── Radio ───────────────────────────────────────
figma.connect(Radio, 'figma://file/0zsTetwqRuSKJRsyJJXcjg?node-id=1258:5707', {
  props: {
    checked: figma.enum('Selection', {
      Selected:   true,
      Unselected: false,
    }),
    disabled: figma.enum('State', {
      Disabled: true,
      Normal:   false,
    }),
  },
  example: ({ checked, disabled }) => (
    <Radio checked={checked} disabled={disabled} />
  ),
});

// ── Divider ─────────────────────────────────────
figma.connect(Divider, 'figma://file/0zsTetwqRuSKJRsyJJXcjg?node-id=1349:173971', {
  props: {
    direction: figma.enum('Type', {
      Horizontal: 'horizontal',
      Vertical:   'vertical',
    }),
    color: figma.enum('Color', {
      Gray:  'gray',
      White: 'white',
    }),
    opacity: figma.enum('Opacity', {
      '007': '007',
      '010': '010',
      '015': '015',
      '020': '020',
    }),
  },
  example: ({ direction, color, opacity }) => (
    <Divider direction={direction} color={color} opacity={opacity} />
  ),
});
