class UserResource {
    constructor(user) {
      this.id = user?.id ?? null;
      this.name = user?.name ?? null;
      this.email = user?.email ?? null;
      this.phone = user?.phone ?? null;
      this.role = user?.role ?? null;
      this.branch_name = user?.branch?.name ?? null; // ambil langsung nama cabang
      this.avatar_url = user?.avatar_url ?? null;
      this.via = user?.login_via ?? null;
      this.is_suspended = user?.is_suspended ?? null;
      this.is_first_login = user?.is_first_login ?? null;
      this.birth = user?.birth ?? null;
      this.last_login = user?.last_login ?? null;
      this.created_at = user?.created_at ?? null;
      this.updated_at = user?.updated_at ?? null;
    }
  
    static collection(users) {
      return users.map((user) => new UserResource(user));
    }
  }
  
  module.exports = UserResource;
  