//
//  ParametersList.swift
//  OrderScheduling
//
//  Created by 中道 on 2023/8/7.
//

import Foundation

enum OrderTypeEnum : Int, Encodable {
    case TO_ACCEPT_DISPATCH = 1
    case TO_DISPATCH_VEHICLE = 3
    case TO_RESCUE = 5
    case TO_AUDIT_FAILED = 7
    case UNCLOSED_ORDER = 9
    case WITHIN_30_DAYS = 11
    case WITHIN_3_MONTHS = 12
}

public struct LoginCodeParameters : Encodable {
    var phone : String
}

public struct CheckLoginParameters : Encodable {
    var username : String
    var clientType : String = "rescueApp"
    var deviceId : String
}

public struct LoginParameters : Encodable {
    var app_login_json : String
    var client_id : Bool

    public init(app_login_json: String,client_id: Bool) {
        self.app_login_json = app_login_json
        self.client_id = client_id
    }
}

public struct TokenParameters : Encodable {
    var refresh_token : String
    var grant_type : String = "refresh_token"
}

public struct LogoutParameters : Encodable {
    var  deviceId : Int
}

public struct OrderListParameters : Encodable {
    var pageNum : Int
    var pageSize : Int  = 12
    var queryType : OrderTypeEnum
    var searchCode : String?
    var userPhone : String?
    var soleCode : String?
    var contractName : String?
    var contractType : Int?
    var createTimeStart : String?
    var createTimeEnd : String?
    var isAppoint : Int?
    var serviceName : String?
    
    public enum ContractTypeEnum : String, Encodable {
        case baoxian = "保险类"
        case chechan = "车厂类"
        case fours = "4s店类"
        case wuliu = "物流类"
        case sanke = "散客类"
        case xuni = "虚拟类"
        case yiliao = "医疗类"
        case zixun = "400咨询类"
        case huicheng = "回程车"
        case none = ""
    }
    
    public struct ContractTypeValue : Encodable {
        var value : Int?
        init(contractType: ContractTypeEnum) {
            switch contractType {
            case .baoxian:
                self.value = 1
            case .chechan:
                self.value = 2
            case .fours:
                self.value = 3
            case .wuliu:
                self.value = 4
            case .sanke:
                self.value = 5
            case .xuni:
                self.value = 6
            case .yiliao:
                self.value = 7
            case .zixun:
                self.value = 8
            case .huicheng:
                self.value = 9
            default:
                self.value = nil
            }
        }
    }
    
    public enum ServiceTypeEnum : String, Encodable {
        case shi = "是"
        case fou = "否"
        case none = ""
    }
    
    public struct ServiceTypeValue : Encodable {
        var value : Int?
        var string : String?
        init(serviceType: ServiceTypeEnum) {
            switch serviceType {
            case .shi:
                self.value = 1
            case .fou:
                self.value = 0
            default:
                self.value = nil
            }
        }
    }
}

public struct AcceptDispatchParameters : Encodable {
    var userOrderId : Int
    var taskOrderId : Int
}

public struct RefuseDispatchParameters : Encodable {
    public enum RefuseReasonItemEnum : String, Encodable {
        case time = "时间长"
        case disatance = "距离远"
        case cannotDispatch = "无法安排"
    }
    var userOrderId : Int
    var taskOrderId : Int
    var remarkId : String?
    var refuseReasonItem : String?
    var refuseReasonDesc : String?
}

public struct OrderReportParameters : Encodable {
    var queryType : OrderTypeEnum
    var userOrderId : Int
    var orderCode : Int
    var reportingItem : String?
    var reportingDesc : String?
}

public struct DispatchVehicleListParameters : Encodable {
    enum DispatchVehicleListTypeEnum: Int, Encodable {
        case online = 1
        case offline = 2
    }
    var type : DispatchVehicleListTypeEnum
    var userOrderId : Int
    var taskOrderId : Int
    var driverId : Int?
    var vehicleId : Int?
}

public struct DispatchVehicleParameters : Encodable {
    var type : DispatchVehicleTypeEnum
    var userOrderId : Int
    var taskOrderId : Int
    var driverId : Int?
    var vehicleId : Int?
    var driverName : String?
    var driverPhone : String?
    var plateNumber : String?
    enum DispatchVehicleTypeEnum : Int,Encodable {
        case online = 1
        case offline = 2
    }
}

public struct RtspChannelParameters : Encodable {
    var vehicleId : Int
    var external : Int = 1
}

public struct GetVideoUrlParameters : Encodable {
    var vehicleId : Int?
    var simNumber : String?
    var channel : Int?
    var startDate : String?
    var endDate : String?
}

public struct OrderPhotoListParameters : Encodable {
    var userOrderId : Int
    var orderCode : String
    var taskOrderId : Int
}

public struct SupplementOrderPhotoParameters : Encodable {
    var userOrderId : Int
    var orderCode : String
    var taskOrderId : Int
    
    var taskStatus : Int
    var tag : String
    var file : Data
}

public struct UpdateVersionParameters : Encodable {
    var appVersion : String
    var supplierId : Int?
    var sysType : String = "ios"
}

public struct MessageReminderListParameters : Encodable {
    var pageNum : Int
    var pageSize : Int = 12
    var orderBy : String = "create_time"
    var id : Int?
}

public struct ReadMessageReminderParameters : Encodable {
    var id : Int
}

public struct UploadCallRecordParameters : Encodable {
    var userOrderId : Int
    var orderCode : String
    var taskOrderId : Int
    var state : Int
    var callTime : String
    var duration : Int
}

public struct VehicleLogoutParameters : Encodable {
    var vehicleId : Int
}

public struct GiveUpUserOrderParameters : Encodable {
    var userOrderId : Int?
    var taskOrderId : Int?
}

public struct ConfigByCodeParameters : Encodable {
    var code : String
}

public struct AlarmListParameters : Encodable {
    var pageNum : Int
    var pageSize : Int = 50
    var orderBy : String = "create_time"
    var supplierId : Int?
    var handStatus : Int
    public enum HandStatusEnum : Int {
        case pending = 0,dealWithByTechnical,dealWithByOperations
    }
}

public struct GetAlarmByCodeParameters : Encodable {
    var code : String?
}

public struct GetAppealParameters : Encodable {
    var orderCode : String?
}

public struct SaveAppealParameters : Encodable {
    var orderCode : String?
    var vehicleId : Int?
    var msg : String?
}

public struct OnlineReminderParameters : Encodable {
    var supplierId : Int?
}

public struct VehicleMonitorInfoParameters : Encodable {
    var vehicleId : Int?
    var lon : String?
    var lat : String?
    var code : String?
}

public struct NeedConfirmPersonInfoParameters : Encodable {
    var supplierId : Int?
}

public struct JudgeIfNeedConfirmParameters : Encodable {
    var supplierId : Int?
}

public struct GiveUpParameters : Encodable {
    var supplierId : Int?
}

public struct SelectCountBySupplierIdPrameters : Encodable {
    var supplierId : Int?
    var remindApp : Int?
    var userId : Int?
}
