import { UserRole } from '../models';

export const getOppositeRole: (userRole: UserRole, asString?: boolean) => string | UserRole  =
  (role, asString = true) => {
    if (role === UserRole.EMPLOYEE) {
      return asString
        ? 'employer'
        : UserRole.EMPLOYER;
    } else {
      return asString
        ? 'employee'
        : UserRole.EMPLOYEE;
    }
  };

export const getOwnRole: (role: UserRole) => string =
  (role) => getOppositeRole(getOppositeRole(role, false) as any);
