MadeInChinatown / Preparedness

0 stars 1 forks source link

Architect Models for App #34

Open alextakahashi opened 4 years ago

alextakahashi commented 4 years ago

Create Structs for:

alextakahashi commented 4 years ago

Because I can't push

import UIKit

protocol Nameable {
    var name: String { get }
}

protocol Contactable {
    var name: String { get }
    var email: String { get }
    var phoneNumber: String { get }
}

protocol FamilyConstructable {}

struct PersonModel: Nameable, Contactable, FamilyConstructable {
    let name: String
    let email: String
    let phoneNumber: String
//
//    init(name: String, email: String, phoneNumber: String) {
//        self.name = name
//        self.email = email
//        self.phoneNumber = phoneNumber
//    }
}

enum PetType {
    case Dog
    case Cat
    case Fish
    case Hamster
    case Unknown
}

struct PetModel: Nameable, FamilyConstructable {

    var name: String
    var animalType: PetType?

    init(name: String, animalType: PetType?) {
        self.name = name
        self.animalType = animalType
    }
}

struct HouseholdModel {
    let name: String
    let familyMembers: [Contactable]
    let pets: [PetType]?
}

enum DisasterType {
    case Earthquake
    case Fire
    case Heatwave
    case Pandemic
    case Unknown
}

struct TodoModel {
    let title: String
    let isCompleted: Bool
}

struct DisasterModel {
    let title: String
    let type: DisasterType
    let icon: UIImage
    let todoModels: [TodoModel]?
}