import CipUrlEditor from '../../../cip-url-editor'
import { useFormInput } from '@cip/components/hooks/form-input'
import { formInputProps, fromInputEmits } from '../../form-input-props'
export default {
  name: 'BasicUrlEditor',
  props: formInputProps,
  emits: [...fromInputEmits],
  setup (props, ctx) {
    const { securityConfig, width, proxyValue, proxyOtherValue } = useFormInput(props, ctx, { maxOtherKey: 3 })
    return () => <CipUrlEditor
      v-models={[
        [proxyValue.value, 'host'],
        [proxyOtherValue[0].value, 'protocol'],
        [proxyOtherValue[1].value, 'port'],
        [proxyOtherValue[2].value, 'path']
      ]}
      style={{ width: width.value }}
      portMin={securityConfig.value.portMin}
      portMax={securityConfig.value.portMax}
      disabledConfig={securityConfig.value.disabledConfig}
    />
  }
}
