{% import "_includes/forms" as forms %}

{{ forms.autosuggestField({
    label: "API Key"|t('sendgrid'),
    id: 'apiKey',
    name: 'apiKey',
    instructions: 'Enter an API key (which you can generate in your <a href="https://app.sendgrid.com/settings/api_keys" target="_blank">SendGrid account</a>).'|t('sendgrid'),
    suggestEnvVars: true,
    suggestions: craft.cp.getEnvSuggestions(),
    value: adapter.apiKey,
    errors: adapter.getErrors('apiKey'),
    required: true,
}) }}

{{ forms.editableTableField({
    label: "Categories"|t('sendgrid'),
    id: 'categories',
    name: 'categories',
    instructions: 'Add one or more <a href="https://docs.sendgrid.com/glossary/categories" target="_blank">categories</a> to emails.'|t('sendgrid'),
    cols: [
        {
            type: 'singleline',
            heading: 'Category Name'|t('sendgrid'),
        },
    ],
    rows: adapter.categories,
    maxRows: 10,
    addRowLabel: "Add a category"|t('sendgrid'),
    allowAdd: true,
    allowDelete: true,
    allowReorder: true,
}) }}
