import { decodeViewConfig } from '@dvn/core/models/view-config-decoder';
import { atamaPairConfigs } from './atama-pair-configs';
import { dvnSpaces } from './dvn-spaces';
import { takvimAvailabilityConfigs } from './takvim-availability-configs';
import { uyeMembershipConfigs } from './uye-membership-configs';
export const dvnViewConfigs = (config) => ({
  // all mentees card list view
  dvnViewConfigs1: decodeViewConfig({
    _id: 'dvnViewConfigs1',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {
      main: {
        cardViewConfig: {
          header: {
            title: {
              fieldId: 'user.firstName',
            },
          },
          body: {
            fields: [
              { fieldId: 'city' },
              { fieldId: 'bio' },
            ]
          }
        },
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    title: 'Mentees',
    type: 'list-view-card',
    table: uyeMembershipConfigs(config).uyeMembershipConfigs1.toObject(),
    query: {
      fields: [
        { fieldId: 'bio' },
        { fieldId: 'city' },
      ]
    },
  }),
  // all mentors card list view
  dvnViewConfigs2: decodeViewConfig({
    _id: 'dvnViewConfigs2',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {
      main: {
        cardViewConfig: {
          header: {
            title: {
              fieldId: 'user.firstName',
            },
          },
          body: {
            fields: [
              { fieldId: 'bio' },
              { fieldId: 'city' },
              { fieldId: 'company' },
              { fieldId: 'title' },
            ]
          }
        },
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    title: 'Mentors',
    type: 'list-view-card',
    table: uyeMembershipConfigs(config).uyeMembershipConfigs2.toObject(),
    query: {
      fields: [
        { fieldId: 'bio' },
        { fieldId: 'city' },
        { fieldId: 'company' },
        { fieldId: 'title' },
        { fieldId: 'user' },
      ]
    }
  }),
  // pair card list view for mentors to view mentees in simple-pairs table
  dvnViewConfigs3: decodeViewConfig({
    _id: 'dvnViewConfigs3',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {
      main: {
        cardViewConfig: {
          header: {
            title: {
              fieldId: 'user.firstName',
            },
          },
          body: {
            fields: [
              { fieldId: 'city' },
              { fieldId: 'bio' },
            ]
          },
          footer: {
            actions: [
              {
                data: {
                  type: 'navigation',
                  direction: 'forward',
                  placement: 'view',
                  viewId: 'dvnViewConfigs5',
                  params: {
                    conversionConfig: {
                      'item._id': 'memberToViewRefFieldValue',
                      'item.pairId': 'pairId',
                    }
                  }
                },
                ui: {
                  label: 'View Detail',
                  name: 'open-pair-detail-view',
                  view: 'flat'
                }
              }
            ]
          }
        },
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    title: 'My Mentees',
    type: 'atama-member-pairs-overview-view',
    table: atamaPairConfigs(config).atamaPairConfigs1.toObject(),
    params: {
      userRefFieldId: {
        required: true,
        value: 'leader'
      },
      memberToViewRefFieldId: {
        required: true,
        value: 'follower',
      }
    },
  }),
  // pair card list view for mentees to view mentors in simple-pairs table
  dvnViewConfigs4: decodeViewConfig({
    _id: 'dvnViewConfigs4',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {
      main: {
        cardViewConfig: {
          header: {
            cover: {
              //   aspectRatio: 16 / 9,
              //   fieldId: 'imageUrl',
              size: 100,
            },
            image: {
              fieldId: 'user.imageUrl',
              size: 72,
            },
            title: {
              fieldId: 'fullName',
            },
          },
          body: {
            fields: [
              { fieldId: 'company' },
              { fieldId: 'title' },
              { fieldId: 'city' },
            ]
          },
          footer: {
            actions: [
              {
                data: {
                  type: 'navigation',
                  direction: 'forward',
                  placement: 'view',
                  viewId: 'dvnViewConfigs9',
                  params: {
                    conversionConfig: {
                      'item._id': 'memberToViewRefFieldValue',
                      'item.pairId': 'pairId',
                    }
                  }
                },
                ui: {
                  label: 'View User & Meet',
                  name: 'open-pair-detail-view',
                  view: 'ghost',
                }
              }
            ]
          }
        },
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    title: 'My Mentors',
    type: 'atama-member-pairs-overview-view',
    table: atamaPairConfigs(config).atamaPairConfigs1.toObject(),
    params: {
      userRefFieldId: {
        required: true,
        value: 'follower'
      },
      memberToViewRefFieldId: {
        required: true,
        value: 'leader',
      },
      viewIdToNavigateToSelectPair: {
        required: true,
        value: 'dvnViewConfigs6',
      },
    },
  }),
  // pair detail view for mentors to view the mentee and the other details (sessions, etc)
  dvnViewConfigs5: decodeViewConfig({
    _id: 'dvnViewConfigs5',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {
      main: {
        infoSummaryCardViewConfig: {
          header: {},
          body: {
            fields: [
              { fieldId: 'city' },
            ],
          },
          footer: {}
        },
        infoDetailCardViewConfig: {
          header: {},
          body: {
            fields: [
              { fieldId: 'city' },
              { fieldId: 'bio' },
            ],
          },
          footer: {}
        },
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    title: 'Pair Details',
    type: 'atama-member-pair-detail-view',
    table: atamaPairConfigs(config).atamaPairConfigs1.toObject(),
    params: {
      userRefFieldId: {
        required: true,
        value: 'leader'
      },
      memberToViewRefFieldId: {
        required: true,
        value: 'follower',
      },
      memberToViewRefFieldValue: {
        required: true,
      },
      pairId: {
        required: true,
      },
      viewIdToNavigateOnEndPair: {
        required: true,
        value: 'dvnViewConfigs3',
      }
    },
  }),
  // selection view for mentees to select mentors in simple-pairs table
  dvnViewConfigs6: decodeViewConfig({
    _id: 'dvnViewConfigs6',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {
      main: {
        cardViewConfig: {
          header: {
            title: {
              fieldId: 'user.firstName',
            },
          },
          body: {
            fields: [
              { fieldId: 'company' },
              { fieldId: 'title' },
            ]
          },
        },
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    title: 'Select Mentors',
    type: 'atama-member-pair-selection-view',
    table: atamaPairConfigs(config).atamaPairConfigs1.toObject(),
    params: {
      userRefFieldId: {
        required: true,
        value: 'follower'
      },
      memberToViewRefFieldId: {
        required: true,
        value: 'leader',
      },
      viewIdToNavigateOnSelectionDone: {
        required: true,
        value: 'dvnViewConfigs4',
      },
    },
  }),
  // availability settings
  dvnViewConfigs7: decodeViewConfig({
    _id: 'dvnViewConfigs7',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {},
    space: dvnSpaces(config).dvnSpaces1,
    title: 'My Available Times',
    type: 'takvim-availability-settings-view',
    table: takvimAvailabilityConfigs(config).takvimAvailabilitiesBasic.toObject(),
  }),
  // edit membership info form for mentees
  dvnViewConfigs8: decodeViewConfig({
    _id: 'dvnViewConfigs8',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {},
    space: dvnSpaces(config).dvnSpaces1,
    title: 'My Info',
    type: 'member-info-form-view',
    table: uyeMembershipConfigs(config).uyeMembershipConfigs1.toObject(),
  }),
  // pair detail view for mentees to view the mentor and the other details (sessions, etc)
  dvnViewConfigs9: decodeViewConfig({
    _id: 'dvnViewConfigs9',
    _created: new Date(),
    _updated: new Date(),
    base: 'khanguru',
    ui: {
      main: {
        infoSummaryCardViewConfig: {
          header: {},
          body: {
            fields: [
              { fieldId: 'company' },
              { fieldId: 'title' },
              { fieldId: 'city' },
            ],
          },
          footer: {}
        },
        infoDetailCardViewConfig: {
          header: {},
          body: {
            fields: [
              { fieldId: 'company' },
              { fieldId: 'title' },
              { fieldId: 'city' },
              { fieldId: 'bio' },
            ],
          },
          footer: {}
        },
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    title: 'Pair Details',
    type: 'atama-member-pair-detail-view',
    table: atamaPairConfigs(config).atamaPairConfigs1.toObject(),
    params: {
      userRefFieldId: {
        required: true,
        value: 'follower'
      },
      memberToViewRefFieldId: {
        required: true,
        value: 'leader',
      },
      memberToViewRefFieldValue: {
        required: true,
      },
      pairId: {
        required: true,
      },
      viewIdToNavigateOnEndPair: {
        required: true,
        value: 'dvnViewConfigs3',
      }
    },
  }),
});
