import 'package:test_sa/models/base.dart';

class Company extends Base {
  final int? id;
  final String? companyName;
  final String? prefix;
  final int? loginTypeId;
  final String? companyPhoto;
  final int? assetGroupId;

  Company({
    this.id,
    this.companyName,
    this.prefix,
    this.loginTypeId,
    this.companyPhoto,
    this.assetGroupId,
  }) : super(identifier: id?.toString(), name: companyName);

  factory Company.fromJson(Map<String, dynamic> json) {
    return Company(
      id: json['id'],
      companyName: json['name'],
      prefix: json['prefix'],
      loginTypeId: json['loginTypeId'],
      companyPhoto: json['companyPhoto'],
      assetGroupId: json['assetGroupId'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'name': companyName,
      'prefix': prefix,
      'loginTypeId': loginTypeId,
      'companyPhoto': companyPhoto,
      'assetGroupId': assetGroupId,
    };
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is Company &&
          runtimeType == other.runtimeType &&
          id == other.id;

  @override
  int get hashCode => id.hashCode;
}
