import { BankCodeGEO, BankCodeUZ, ExternalIdentifierType } from "../enums";
import { StandingOrder } from "../models";
import { Currency } from "./Money";

export class InitTransferRequest {
  SenderBankCode: BankCodeUZ | BankCodeGEO;
  ReceiverBankCode: BankCodeUZ | BankCodeGEO;
  UserId: string;
  SourceCardId: string;
  DestinationCardId: string;
  ExternalIdentifier: string;
  ExternalIdentifierType: ExternalIdentifierType;
  Purpose: string;
  MediaId: string;
  MediaUrl: string;
  LongMediaUrl: string;
  SaveAsFavorite: boolean;
  FavoriteName: string;
  FavoriteImage: Blob;
  OtpToken: string;
  LocalAuthenticationId: string;
  "Amount.Amount": number;
  "Amount.CurrencyCode": Currency;

  constructor(data: {
    SenderBankCode?: BankCodeUZ | BankCodeGEO;
    ReceiverBankCode?: BankCodeUZ | BankCodeGEO;
    UserId?: string;
    SourceCardId?: string;
    DestinationCardId?: string;
    ExternalIdentifier?: string;
    ExternalIdentifierType?: ExternalIdentifierType;
    Purpose?: string;
    MediaId?: string;
    MediaUrl?: string;
    LongMediaUrl?: string;
    SaveAsFavorite?: boolean;
    FavoriteName?: string;
    FavoriteImage?: Blob;
    OtpToken?: string;
    LocalAuthenticationId?: string;
    "Amount.Amount"?: number;
    "Amount.CurrencyCode"?: Currency;
  }) {
    this.SenderBankCode = data.SenderBankCode;
    this.ReceiverBankCode = data.ReceiverBankCode;
    this.UserId = data.UserId;
    this.SourceCardId = data.SourceCardId;
    this.DestinationCardId = data.DestinationCardId;
    this.ExternalIdentifier = data.ExternalIdentifier;
    this.ExternalIdentifierType = data.ExternalIdentifierType;
    this.Purpose = data.Purpose;
    this.MediaId = data.MediaId;
    this.MediaUrl = data.MediaUrl;
    this.LongMediaUrl = data.LongMediaUrl;
    this.SaveAsFavorite = data.SaveAsFavorite;
    this.FavoriteName = data.FavoriteName;
    this.FavoriteImage = data.FavoriteImage;
    this.OtpToken = data.OtpToken;
    this.LocalAuthenticationId = data.LocalAuthenticationId;
    this["Amount.Amount"] = data["Amount.Amount"];
    this["Amount.CurrencyCode"] = data["Amount.CurrencyCode"];
  }
}

export interface InitTransferResponse {
  data: {};
}

export class FinalizeTransferRequest {
  transferId: string;
  cardId: string;
  ipAddress: string;

  constructor(data: {
    transferId: string;
    cardId: string;
    ipAddress?: string;
  }) {
    this.transferId = data.transferId;
    this.cardId = data.cardId;
    this.ipAddress = data.ipAddress;
  }
}
export interface Transfer {
  isCompleted: boolean;
  amount: number;
  externalIdentifier: string;
  destinationExternalIdentifierType: ExternalIdentifierType;
  senderFirstName: string;
  senderLastName: string;
  senderPhoneNumber: string;
  senderPersonalNumber: string;
  senderProfileImageUrl: string;
  deviceToken: string;
  platform: string;
  receiverPhoneNumber: string;
  receiverCardMask: string;
  purpose: string;
  mediaUrl: string;
  longMediaUrl: string;
}
export interface TransferFavorite {
  id: number;
  identifier: string;
  identifierName: string;
  identifierType: ExternalIdentifierType;
  extra: string;
  name: string;
  imageUrl: string;
  order: number;
  standingOrder: StandingOrder;
  isOwnIdentifier: boolean;
  cursor: string;
}

export interface InitiateTransferResponse {
  receiveUrl: string;
  mediaUrl: string;
  transferFavoriteId: number;
  isOwnIdentifier: boolean;
  transferFavorite: TransferFavorite;
}

export class TransferDetailsRequest {
  constructor(public TransferId: string) {}
}
