base_language: en-us

entities:

	AbstractHuman:

		title: Abstract Human
		description: It is an abstract which produces any human
   	type: abstract_human.entity_id

    tile:

      abstract: true
      status: active

      roles_spec:

        _self:
          status_spec:
            active:
              permissions:
                - updateSelf
                - updatePassword

      menu:

        home_links:
          title: Settings
          link: /settings
          page: this.forms.settings
        nav_dropdown:
          settings:
            title: Settings
            page: this.forms.settings
          logout:
            title: Logout
            icon: exit
            action: this.actions.logout
        main_buttons:
            title: Follow
            icon: follow
            page: this.forms.follow

      actions:

        updateSelf:
          assert: - возвращает окей если выполнен правильно и ошибочное условие если было не правильно
            - EQUAL self.active true ERROR "Your profile is not active"
            - EQUAL self.id this.id ERROR "This is not your profile"
          args: - то что функция принимает
            ava: image
            bg: image
            first_name: string
            last_name: string
            description: string
            link: link
            birthday: datetime
          code:
            - UPDATE_SELF:
								args: args
            - UPDATE_SELF:
								title: "{first_name} {last_name}"
            - RETURN: _self
							

        updatePassword:
          assert:
            - EQUAL this.status active
            - EQUAL self.id this.id
          args:
            old_password: password
            new_password: password
          code:
            - CONDITION:
                if: EQUAL authentication.old_password self.password
                true: UPDATE_SELF authentication.password new_password
                false: ERROR old_password "Field is incorrect"

        settings:
          type: page
          title: Settings
          tabs:
            general:
              title: General
              icon: cog
              fieldsets:
                pictures:
                  title: Profile Images
                  direction: horizontal
                  fields:
                    ava:
                      value: this.ava
                      input: picture
                      size: 1200x1200
                      button: Edit Profile Photo
                    bg:
                      value: this.bg
                      input: picture
                      size: 2300x800
                      button: Edit Cover Photo
                info:
                  title: Profile Info
                  direction: vertical
                  fields:
                    first_name:
                      value: this.profile.first_name
                      label: First Name
                      input: text
                      required: true
                      action: this.actions.updateSelf
                    last_name:
                      value: this.profile.last_name
                      label: Last Name
                      input: text
                      required: true
                      action: this.actions.updateSelf
                    link:
                      value: this.profile.link
                      label: Link
                      input: link
                      required: true
                      action: this.actions.updateSelf
                    description:
                      value: this.profile.description
                      label: About
                      input: text
                      required: true
                      action: this.actions.updateSelf
                    birthday:
                      value: this.profile.birthday
                      label: birthday
                      input: datetime
                      required: true
                      action: this.actions.updateSelf

	            security:
	              title: Security
	              icon: lock
	              fieldsets:
	                update_password:
	                  title: Update password
	                  direction: vertical
	                  fields:
	                    old_password:
	                      input: password
	                      label: Old Password
	                    new_password:
	                      input: password
	                      label: New Password
	                    new_password_confirm:
	                      input: password
	                      label: New Password
	                  submit:
											label: Submit form
	                    action: this.actions.updatePassword

              upload_avatar:
                  title: Upload Avatar
                  direction: vertical
                  fields:
                    file:
                      value: this.ava
                      input: file
                      label: avatar