import 'package:flutter/foundation.dart';

import 'package:pshared/config/constants.dart';
import 'package:pshared/models/organization/bound.dart';


abstract class PermissionBound extends OrganizationBound {
  String get permissionRef;
}

@immutable
class _PermissionBoundImp implements PermissionBound {
  @override
  final String permissionRef;
  final OrganizationBound organizationBound;

  @override
  get organizationRef => organizationBound.organizationRef;

  const _PermissionBoundImp({
    required this.permissionRef,
    required this.organizationBound,
  });
}

PermissionBound newPermissionBound({ 
  required OrganizationBound organizationBound, 
  String? permissionRef,
}) => _PermissionBoundImp(
  permissionRef: permissionRef ?? Constants.nilObjectRef, 
  organizationBound: organizationBound,
);