part of 'create_role_bloc.dart';

@immutable
class CreateRoleState {
  final bool isExpanded;
  final PositionEntity entity;
  final PositionValidationState? validationState;

  const CreateRoleState({
    this.isExpanded = true,
    required this.entity,
    this.validationState,
  });

  CreateRoleState copyWith(
      {bool? isExpanded,
      PositionEntity? entity,
      PositionValidationState? validationState}) {
    return CreateRoleState(
      isExpanded: isExpanded ?? this.isExpanded,
      entity: entity ?? this.entity,
      validationState: validationState,
    );
  }
}

class PositionValidationState {
  final String? skillError;
  final String? departmentError;
  final String? countError;
  bool showed;

  bool get hasError =>
      skillError != null || countError != null || departmentError != null;

  String? get message {
    return skillError ?? countError ?? departmentError ?? '';
  }

  PositionValidationState(
      {this.skillError,
      this.countError,
      this.departmentError,
      this.showed = false});

  PositionValidationState copyWith({
    String? skillError,
    String? countError,
    String? departmentError,
  }) {
    return PositionValidationState(
        skillError: skillError ?? this.skillError,
        countError: countError ?? this.countError,
        departmentError: departmentError ?? this.departmentError,
        showed: showed);
  }
}
