mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-06 16:07:42 +02:00
54 lines
1.4 KiB
Swift
54 lines
1.4 KiB
Swift
/*
|
|
* Copyright (c) 2021 BWI GmbH
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import Foundation
|
|
|
|
|
|
struct WorkTime : Codable {
|
|
enum Days : Int, CaseIterable, Codable {
|
|
case sunday = 1
|
|
case monday = 2
|
|
case tuesday = 3
|
|
case wednesday = 4
|
|
case thursday = 5
|
|
case friday = 6
|
|
case saturday = 7
|
|
case other
|
|
|
|
public init!(_ value:RawValue) {
|
|
guard let validValue = Days(rawValue:value) else {
|
|
self = .other
|
|
return
|
|
}
|
|
self = validValue
|
|
}
|
|
|
|
static func workdays() -> Set<Days> {
|
|
Set(Days.allCases.filter { (2...6).contains( $0.rawValue ) })
|
|
}
|
|
}
|
|
|
|
var workdays : Set<Days>
|
|
var startTime : Int
|
|
var finishTime : Int
|
|
|
|
init() {
|
|
workdays = WorkTime.Days.workdays()
|
|
startTime = 8 * 60
|
|
finishTime = 17 * 60
|
|
}
|
|
}
|