import { ImagePosition } from '@dvn/alaca/components/dvn-card-header/models';
import { ViewPlacement } from '@dvn/core/models/app-config';
import { DetailViewConfig } from '@dvn/core/models/detail-view-config';
import { AppViewType } from '@dvn/core/models/view-config';
import { dataConfigs } from '../data-configs';
import { spaces } from '../spaces';
import * as changeOrganisationDomainFormView from './form-view-organisation-change-domain';
export const ID = 'detail-view-organisation';
export const viewConfig = DetailViewConfig.decode({
  _id: ID,
  base: 'mentornity',
  space: spaces['mentornity'],
  table: dataConfigs['organisations'],
  title: 'Organisation',
  ui: {
    cardConfig: {
      header: {
        actions: [{
            ui: {
              name: 'change-domain',
              buttonType: 'button',
              label: 'Change Domain',
              scale: 'medium',
              view: 'solid'
            },
            data: {
              type: 'navigation',
              viewId: changeOrganisationDomainFormView.ID,
              direction: 'forward',
              placement: ViewPlacement.Dialog,
              params: {
                conversionConfig: {
                  'item._id': 'organisationId',
                  'item.domain': 'domain',
                }
              }
            }
          }],
        cover: {
          fieldId: 'coverUrl',
          size: 256,
        },
        image: {
          fieldId: 'logoUrl',
          shape: 'rounded',
          size: 96,
          position: ImagePosition.Center,
        },
        title: {
          fieldId: 'title',
        },
      },
      body: {
        fields: [
          {
            fieldId: 'domain',
          },
          {
            fieldId: 'status',
          },
          {
            fieldId: 'model',
          },
          {
            fieldId: 'description',
            lines: 0,
          },
          {
            fieldId: 'createdAt',
          },
          {
            fieldId: 'webSiteUrl',
          },
          {
            fieldId: 'facebookUrl',
          },
          {
            fieldId: 'twitterUrl',
          },
          {
            fieldId: 'linkedInUrl',
          },
          {
            fieldId: '_id',
          },
        ]
      },
    }
  },
  type: AppViewType.DetailViewCard,
  params: {
    itemId: {
      required: true,
    },
  },
});
