import { c } from 'ttag';
import { Select } from 'react-components';
import React from 'react';
import PropTypes from 'prop-types';

export const FREQUENCY = {
    ONCE: 0,
    WEEKLY: 'WEEKLY',
    MONTHLY: 'MONTHLY',
    YEARLY: 'YEARLY'
};

const FrequencyInput = ({ value, onChange }) => {
    const frequencies = [
        { text: c('Option').t`Do not repeat`, value: FREQUENCY.ONCE },
        { text: c('Option').t`Every week`, value: FREQUENCY.WEEKLY },
        { text: c('Option').t`Every month`, value: FREQUENCY.MONTHLY },
        { text: c('Option').t`Every year`, value: FREQUENCY.YEARLY }
    ];
    return <Select value={value} options={frequencies} onChange={({ target }) => onChange(target.value)} />;
};

FrequencyInput.propTypes = {
    value: PropTypes.oneOf([FREQUENCY.ONCE, FREQUENCY.WEEKLY, FREQUENCY.MONTHLY, FREQUENCY.YEARLY]).isRequired,
    onChange: PropTypes.func.isRequired
};

export default FrequencyInput;

@@ -167,9 +167,14 @@
 CE: 
-0
+'ONCE'
 ,%0A  

Fix frequency once