import { BaseField } from '@dvn/core/doldurma/src/BaseField';
import { PairConfig } from '@dvn/core/models/pair-config';
import { Comparison, Rule, RuleType } from '@dvn/core/models/rule';
import { atamaMeetingStructureConfigs } from './atama-meeting-structure-configs';
import { dvnSpaces } from './dvn-spaces';
import { takvimCalendarConfigs } from './takvim-calendar-configs';
export const atamaPairConfigs = (config) => ({
  // simple pair config
  atamaPairConfigs1: PairConfig.decode({
    _id: 'atamaPairConfigs1',
    _created: new Date(),
    _updated: new Date(),
    actionPermissions: {
      leader: {
        completePair: true,
      }
    },
    base: 'khanguru',
    fields: [
      {
        type: 'reference',
        id: 'leader',
        otherCollection: 'uyeMembershipsMentors',
        fields: [],
        title: 'Leader',
      },
      {
        type: 'reference',
        id: 'follower',
        otherCollection: 'uyeMembershipsMentees',
        fields: [],
        title: 'Follower',
      },
      {
        id: 'status',
        title: 'Status',
        type: 'text',
      },
    ],
    name: 'atamaPairsSimplePairs',
    space: dvnSpaces(config).dvnSpaces1,
    calendarConfig: takvimCalendarConfigs(config).takvimCalendarConfigsBasic.toDBRef('takvimCalendarConfigs'),
    structure: atamaMeetingStructureConfigs(config).atamaMeetingStructureConfigs1,
  }),
  // simple pair config with selection
  atamaPairConfigs2: PairConfig.decode({
    _id: 'atamaPairConfigs2',
    _created: new Date(),
    _updated: new Date(),
    actionPermissions: {
      leader: {
        completePair: true,
      }
    },
    base: 'khanguru',
    fields: [
      {
        type: 'reference',
        id: 'leader',
        otherCollection: 'uyeMembershipsMentors',
        fields: [],
        title: 'Leader',
      },
      {
        type: 'reference',
        id: 'follower',
        otherCollection: 'uyeMembershipsMentees',
        fields: [],
        title: 'Follower',
      },
      {
        id: 'status',
        title: 'Status',
        type: 'text',
      },
    ],
    name: 'atamaPairsSimplePairs',
    selection: {
      follower: {
        pairLimit: 2,
        selectionLimit: 5,
        rules: [
          new Rule([
            {
              firstField: BaseField.decode({ id: 'city', type: 'text' }),
              comparison: Comparison.eq,
              secondField: BaseField.decode({ id: 'city', type: 'text' }),
            }
          ], RuleType.comparison),
        ],
        status: 'active',
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    // structure: atamaMeetingStructureConfigs(config).atamaMeetingStructureConfigs1,
  }),
  // structured pair config with selection
  atamaPairConfigs3: PairConfig.decode({
    _id: 'atamaPairConfigs3',
    _created: new Date(),
    _updated: new Date(),
    actionPermissions: {
      leader: {
        completePair: true,
      }
    },
    base: 'khanguru',
    fields: [
      {
        type: 'reference',
        id: 'leader',
        otherCollection: 'uyeMembershipsMentors',
        fields: [],
        title: 'Leader',
      },
      {
        type: 'reference',
        id: 'follower',
        otherCollection: 'uyeMembershipsMentees',
        fields: [],
        title: 'Follower',
      },
      {
        id: 'status',
        title: 'Status',
        type: 'text',
      },
    ],
    name: 'atamaPairsSimplePairs',
    selection: {
      follower: {
        pairLimit: 2,
        selectionLimit: 5,
        rules: [
          new Rule([
            {
              firstField: BaseField.decode({ id: 'city', type: 'text' }),
              comparison: Comparison.eq,
              secondField: BaseField.decode({ id: 'city', type: 'text' }),
            }
          ], RuleType.comparison),
        ],
        status: 'active',
      },
    },
    space: dvnSpaces(config).dvnSpaces1,
    structure: atamaMeetingStructureConfigs(config).atamaMeetingStructureConfigs1,
  }),
});
