export interface User {
  _id?: string;
  boardUserId?: number;
  username?: string;
  squad?: Squad;
  rank?: Rank;
  awards?: Award[];
}

export interface Squad {
  _id?: string;
  name?: string;
  fraction?: string;
  sortingNumber?: number;
}

export interface Rank {
  _id?: string;
  name?: string;
  fraction?: string;
  level?: number;
}

export interface Award {
  _id?: string,
  userId: string,
  decorationId?: Decoration;
  reason?: string;
  date?: number; // since Date.now() returns a number
  confirmed?: boolean;
}

export interface Decoration {
  _id?: string;
  name?: string;
  description?: string;
  fraction?: string;
  sortingNumber?: number;
  isMedal?: boolean;
}

export interface Army {
  NATO: {
    squads: {
      _id,
      name,
      memberCount,
      members: {
        _id,
        username,
        rank
      }[],
    }[],
    memberCount
  },
  CSAT: {
    squads: {
      _id,
      name,
      memberCount,
      members: {
        _id,
        username,
        rank
      }[],
    }[],
    memberCount
  },
}

export interface Tag {
  label: string;
}
export interface Assignee {
  name?: string;
  email?: string;
}
export interface Task {
  id?: number;
  title?: string;
  description?: string;
  tags?: Tag[];
  favorite?: boolean;
  state?: string;
  assignee?: Assignee;
}

export const states = ['BACKLOG', 'IN_PROGRESS', 'TEST', 'COMPLETED'];

export function createInitialTask(): Task {
  return {
    assignee: {},
    tags: [],
    state: states[0]
  };
}


export const stateGroups = [
  {
    label: 'Planung',
    states: ['BACKLOG']
  },
  {
    label: 'Entwicklung',
    states: ['IN_PROGRESS', 'TEST']
  },
  {
    label: 'In Produktion',
    states: ['COMPLETED']
  }
];

export const stateTexts = {
  'BACKLOG': 'Backlog',
  'IN_PROGRESS': 'In Bearbeitung',
  'TEST': 'Im Test',
  'COMPLETED': 'Abgeschlossen'
};

export const statesAsObjects = [{name: 'BACKLOG', text: 'Backlog'},
  {name: 'IN_PROGRESS', text: 'In Bearbeitung'},
  {name: 'TEST', text: 'Test'},
  {name: 'COMPLETED', text: 'Abgeschlossen'}];