import 'dart:convert';

class Vendor {
  final String id;
  final String password;
  final String address;
  final String token;
  Vendor({
    required this.id,
    required this.password,
    required this.address,
    required this.token,
  });

  Map<String, dynamic> toMap() {
    return {
      'id': id,
      'password': password,
      'address': address,
      'token': token,
    };
  }

  factory Vendor.fromMap(Map<String, dynamic> map) {
    return Vendor(
      id: map['id'] ?? '',
      password: map['password'] ?? '',
      address: map['address'] ?? '',
      token: map['token'] ?? '',
    );
  }

  String toJson() => json.encode(toMap());

  factory Vendor.fromJson(String source) => Vendor.fromMap(json.decode(source));
}
