########################################################################
# contact_form
########################################################################

name: contact_form
uploadPath: ../media/contact_form
meta:
    label: { de: "Kontaktformular", en: "Contact Form" }
    muiIcon: email
    rowIdentTpl: { twig: "{{ email }} - {{ subject }}" }
    views:
        - type: simpleList
          mediaQuery: "(max-width: 600px)"
          primaryText: email
          secondaryText: subject
          tertiaryText: insertTime
        - type: table
          columns:
              - insertTime
              - email
              - subject

permissions:
    public:
        methods:
            get: false
            post: false
            put: false
            delete: false
    user:
        methods:
            get: true
            post: false
            put: false
            delete: false

    # token als Zusatzsicherung gegen Spam, mehr siehe Hook
    "token:${PUBLIC_TOKEN}":
        methods:
            get: false
            post: true
            put: false
            delete: false

hooks:
    post:
        create:
            type: javascript
            file: hooks/contact_form/post_create.js
        return:
            type: javascript
            file: hooks/contact_form/post_return.js

fields:
    - name: firstname
      type: string
      meta:
          label: { de: "Vorname", en: "firstname" }
    - name: lastname
      type: string
      meta:
          label: { de: "Nachname", en: "lastname" }
    - name: email
      type: string
      meta:
          label: { de: "Email", en: "email" }
    - name: postcode
      type: string
      meta:
          label: { de: "Postleitzahl", en: "postcode" }
    - name: subject
      type: string
      meta:
          label: { de: "Betreff", en: "subject" }
    - name: message
      type: string
      meta:
          label: { de: "Nachricht", en: "message" }
    - name: files
      type: object[]
      meta:
          label: { de: "Dateien", en: "files" }
      subFields:
          - name: file
            type: file
            meta:
                label: { de: "", en: "" }
          - name: title
            type: string
            meta:
                label: { de: "Dateititel", en: "file title" }
