<script>
import { markRaw } from 'vue'

import DefaultModal from '@inside-library/components/modals/default/DefaultModal'
import UserModalFields from '../../inside-customs/components/users/UserModalFields'

export default {
  name: 'user-modal',
  components: {
    UserModalFields
  },
  extends: DefaultModal,
  data() {
    return {
      selection: {
        lastname: 'lastname',
        firstname: 'firstname',
        avatar: 'image',
        linkedin: 'linkedin_link.url',
        jobTitle: 'job_title',
        email: 'email',
        birthday: 'birthday',
        gsm: 'gsm',
        directLine: 'direct_line',
        location: 'locations.data[0].title',
        spaces: 'spaces.data',
        office: 'office',
        assistants: 'assistants.data',
        mainAssistant: 'mainAssistant.data',
        mainAssistantTo: 'mainAssistantTo.data',
        personnalAssistantTo: 'personnal_assistant_to.data',
        username: 'username',
        startDate: 'start_date',
        languages: 'languages.data',
        expertises: 'expertises.data',
        floorMap: 'floor_maps.image',
        status: 'users_status.title',
        uuid: 'uuid'
      }
    }
  },
  methods: {
    scaffold(fields) {
      return {
        sections: [
          {
            fields: [
              {
                tag: markRaw(UserModalFields),
                data: { heritedData: fields }
              }
            ]
          }
        ]
      }
    }
  }
}
</script>
