import 'package:json_annotation/json_annotation.dart';

import 'package:pshared/api/requests/login_data.dart';
import 'package:pshared/data/dto/describable.dart';
import 'package:pshared/data/mapper/describable.dart';
import 'package:pshared/models/describable.dart';

part 'signup.g.dart';


@JsonSerializable(explicitToJson: true)
class SignupRequest {
  final AccountData account;
  final DescribableDTO organization;
  final DescribableDTO ownerRole;
  final DescribableDTO cryptoWallet;
  final DescribableDTO ledgerWallet;
  final String organizationTimeZone;

  const SignupRequest({
    required this.account,
    required this.organization,
    required this.organizationTimeZone,
    required this.ownerRole,
    required this.cryptoWallet,
    required this.ledgerWallet,
  });

  factory SignupRequest.build({
    required AccountData account,
    required Describable organization,
    required String organizationTimeZone,
    required Describable ownerRole,
    required Describable cryptoWallet,
    required Describable ledgerWallet,
  }) => SignupRequest(
    account: account, 
    organization: organization.toDTO(), 
    organizationTimeZone: organizationTimeZone, 
    ownerRole: ownerRole.toDTO(),
    cryptoWallet: cryptoWallet.toDTO(),
    ledgerWallet: ledgerWallet.toDTO(),
  );

  factory SignupRequest.fromJson(Map<String, dynamic> json) => _$SignupRequestFromJson(json);
  Map<String, dynamic> toJson() => _$SignupRequestToJson(this);
}
