'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _reactIntl = require('react-intl');

exports.default = pluginContext => {
  var _pluginContext$inputC = pluginContext.inputComponents;
  const AutocompleteInput = _pluginContext$inputC.AutocompleteInput,
        CompoundInput = _pluginContext$inputC.CompoundInput,
        HierarchyInput = _pluginContext$inputC.HierarchyInput,
        OptionPickerInput = _pluginContext$inputC.OptionPickerInput,
        TextInput = _pluginContext$inputC.TextInput,
        TermPickerInput = _pluginContext$inputC.TermPickerInput,
        CheckboxInput = _pluginContext$inputC.CheckboxInput;
  const config = pluginContext.configHelpers.configKey;
  const extensions = pluginContext.config.extensions;


  return {
    document: Object.assign({
      [config]: {
        view: {
          type: CompoundInput,
          props: {
            defaultChildSubpath: 'ns2:taxon_common'
          }
        }
      },
      'rel:relations-common-list': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/relation'
          }
        },
        'relation-list-item': {
          [config]: {
            view: {
              type: HierarchyInput,
              props: {
                messages: (0, _reactIntl.defineMessages)({
                  parent: {
                    'id': 'hierarchyInput.taxon.parent',
                    'defaultMessage': 'Broader taxon name'
                  },
                  children: {
                    'id': 'hierarchyInput.taxon.children',
                    'defaultMessage': 'Narrower taxon names'
                  },
                  siblings: {
                    'id': 'hierarchyInput.taxon.siblings',
                    'defaultMessage': 'Adjacent taxon names'
                  }
                })
              }
            }
          }
        }
      }
    }, extensions.core.fields, {
      'ns2:taxon_common': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/taxonomy'
          }
        },
        csid: {
          [config]: {
            cloneable: false
          }
        },
        inAuthority: {
          [config]: {
            cloneable: false
          }
        },
        refName: {
          [config]: {
            cloneable: false
          }
        },
        shortIdentifier: {
          [config]: {
            cloneable: false
          }
        },
        taxonTermGroupList: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              required: {
                'id': 'field.taxon_common.taxonTermGroupList.required',
                'defaultMessage': 'At least one term display name is required. Please enter a value.'
              }
            }),
            required: true,
            view: {
              type: CompoundInput
            }
          },
          taxonTermGroup: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.taxon_common.taxonTermGroup.name',
                  'defaultMessage': 'Term'
                }
              }),
              repeating: true,
              view: {
                type: CompoundInput
              }
            },
            termDisplayName: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termDisplayName.name',
                    'defaultMessage': 'Display name'
                  }
                }),
                required: true,
                view: {
                  type: TextInput
                }
              }
            },
            termName: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termName.name',
                    'defaultMessage': 'Formatted Display Name'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            termType: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termType.name',
                    'defaultMessage': 'Type'
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'taxonTermTypes'
                  }
                }
              }
            },
            termFlag: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    'id': 'field.taxon_common.termFlag.fullName',
                    'defaultMessage': 'Term flag'
                  },
                  name: {
                    'id': 'field.taxon_common.termFlag.name',
                    'defaultMessage': 'Flag'
                  }
                }),
                view: {
                  type: TermPickerInput,
                  props: {
                    source: 'taxontermflag'
                  }
                }
              }
            },
            termStatus: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termStatus.name',
                    'defaultMessage': 'Status'
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'taxonTermStatuses'
                  }
                }
              }
            },
            termQualifier: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termQualifier.name',
                    'defaultMessage': 'Qualifier'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            termLanguage: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    'id': 'field.taxon_common.termLanguage.fullName',
                    'defaultMessage': 'Term language'
                  },
                  name: {
                    'id': 'field.taxon_common.termLanguage.name',
                    'defaultMessage': 'Language'
                  }
                }),
                view: {
                  type: TermPickerInput,
                  props: {
                    source: 'languages'
                  }
                }
              }
            },
            termPrefForLang: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termPrefForLang.name',
                    'defaultMessage': 'Preferred for lang'
                  }
                }),
                view: {
                  type: CheckboxInput
                }
              }
            },
            termSource: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termSource.name',
                    'defaultMessage': 'Name'
                  },
                  fullName: {
                    'id': 'field.taxon_common.termSource.fullName',
                    'defaultMessage': 'Source name'
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'citation/local,citation/shared,citation/worldcat'
                  }
                }
              }
            },
            termSourceDetail: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termSourceDetail.name',
                    'defaultMessage': 'Detail'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            termSourceID: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termSourceID.name',
                    'defaultMessage': 'ID'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            termSourceNote: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termSourceNote.name',
                    'defaultMessage': 'Note'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            termFormattedDisplayName: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.termFormattedDisplayName.name',
                    'defaultMessage': 'Formatted display name'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            taxonomicStatus: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.taxonomicStatus.name',
                    'defaultMessage': 'Taxonomic status'
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'taxonomicStatuses'
                  }
                }
              }
            }
          }
        },
        taxonRank: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.taxon_common.taxonRank.name',
                'defaultMessage': 'Rank'
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'taxonRanks'
              }
            }
          }
        },
        taxonCurrency: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.taxon_common.taxonCurrency.name',
                'defaultMessage': 'Currency'
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'taxonCurrencies'
              }
            }
          }
        },
        taxonAuthorGroupList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          taxonAuthorGroup: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.taxon_common.taxonAuthorGroup.name',
                  'defaultMessage': 'Author'
                }
              }),
              repeating: true,
              view: {
                type: CompoundInput,
                props: {
                  tabular: true
                }
              }
            },
            taxonAuthor: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.taxonAuthor.name',
                    'defaultMessage': 'Name'
                  },
                  fullName: {
                    'id': 'field.taxon_common.taxonAuthor.fullName',
                    'defaultMessage': 'Author name'
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'person/local,person/shared,organization/local,organization/shared'
                  }
                }
              }
            },
            taxonAuthorType: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.taxonAuthorType.name',
                    'defaultMessage': 'Type'
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'taxonAuthorTypes'
                  }
                }
              }
            }
          }
        },
        taxonYear: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.taxon_common.taxonYear.name',
                'defaultMessage': 'Year'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        taxonCitationList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          taxonCitation: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.taxon_common.taxonCitation.name',
                  'defaultMessage': 'Citation'
                }
              }),
              repeating: true,
              view: {
                type: AutocompleteInput,
                props: {
                  source: 'citation/local,citation/shared,citation/worldcat'
                }
              }
            }
          }
        },
        taxonIsNamedHybrid: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.taxon_common.taxonIsNamedHybrid.name',
                'defaultMessage': 'Is named hybrid'
              }
            }),
            view: {
              type: CheckboxInput
            }
          }
        },
        taxonNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.taxon_common.taxonNote.name',
                'defaultMessage': 'Note'
              }
            }),
            searchView: {
              type: TextInput
            },
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        commonNameGroupList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          commonNameGroup: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.taxon_common.commonNameGroup.name',
                  'defaultMessage': 'Common name'
                }
              }),
              repeating: true,
              view: {
                type: CompoundInput,
                props: {
                  tabular: true
                }
              }
            },
            commonName: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    'id': 'field.taxon_common.commonName.fullName',
                    'defaultMessage': 'Common name'
                  },
                  name: {
                    'id': 'field.taxon_common.commonName.name',
                    'defaultMessage': 'Name'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            commonNameLanguage: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    'id': 'field.taxon_common.commonNameLanguage.fullName',
                    'defaultMessage': 'Common name language'
                  },
                  name: {
                    'id': 'field.taxon_common.commonNameLanguage.name',
                    'defaultMessage': 'Language'
                  }
                }),
                view: {
                  type: TermPickerInput,
                  props: {
                    source: 'languages'
                  }
                }
              }
            },
            commonNameSource: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.commonNameSource.name',
                    'defaultMessage': 'Source'
                  },
                  fullName: {
                    'id': 'field.taxon_common.commonNameSource.fullName',
                    'defaultMessage': 'Common name source'
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'citation/local,citation/shared'
                  }
                }
              }
            },
            commonNameSourceDetail: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.taxon_common.commonNameSourceDetail.name',
                    'defaultMessage': 'Source detail'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            }
          }
        }
      }
    })
  };
};