37 lines
980 B
Swift
37 lines
980 B
Swift
//
|
|
// InheritanceModelInformation.swift
|
|
// Wallet
|
|
//
|
|
// Created by Igor Danich on 05.08.2020.
|
|
// Copyright © 2020 List. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension Inheritance.Model {
|
|
// swiftlint:disable identifier_name
|
|
struct Information: Codable {
|
|
let user_name: String
|
|
let inheritance_date: String
|
|
let inactive_period: Int
|
|
let inheritors: [Heir]
|
|
}
|
|
}
|
|
|
|
extension Inheritance.Model.Information {
|
|
private var _startDate: Date { inheritance_date.serverDate() ?? Date() }
|
|
var startDate: Date { _startDate.addingTimeInterval(Double(TimeZone.current.secondsFromGMT())) }
|
|
var endDate: Date { startDate.addingTimeInterval(Double(inactive_period)) }
|
|
}
|
|
|
|
extension Inheritance.Model.Information {
|
|
struct Heir: Codable {
|
|
let inheritor: String
|
|
let share: String
|
|
}
|
|
}
|
|
|
|
extension Inheritance.Model.Information.Heir {
|
|
var value: String { share.replacingOccurrences(of: " PERCENT", with: "%") }
|
|
}
|