public struct ImageUrlExpireTimeDeserializer: Decodable {
    private let imageUrlExpireTime: String?
    
    private enum CodingKeys: String, CodingKey {
        case imageUrlExpireTime
    }
    
    public init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: CodingKeys.self)
        
        imageUrlExpireTime = try container.decodeIfPresent(String.self, forKey: .imageUrlExpireTime)
        try validateImageUrlExpireTime()
    }
    
    private func validateImageUrlExpireTime() throws {
        guard let expireTime = imageUrlExpireTime else {
            return
        }
        
        // Regular expression to validate time range format
        let regex = #"^(\d{1,2}d)?\s?(\d{1,2}h)?\s?(\d{1,2}m)?$"#
        
        // Validate the time range format
        guard expireTime.range(of: regex, options: .regularExpression) != nil else {
            throw SDKError.invalidFormatMessage("Invalid value for imageUrlExpireTime, check the parameters")
        }
        
        // Extract time range components
        let components = expireTime.components(separatedBy: CharacterSet.whitespaces)
        
        for component in components {
            guard let unit = component.last else {
                throw SDKError.invalidFormatMessage("Invalid time component")
            }
            
            let valueString = String(component.dropLast())
            guard let value = Int(valueString) else {
                throw SDKError.invalidFormatMessage("Invalid time component")
            }
            
            
            switch unit {
            case "m":
                if value <= 29 && components.count == 1 {
                    throw SDKError.invalidFormatMessage("Invalid value for imageUrlExpireTime, check the minute(s)")
                } else if value < 0 || value > 59 {
                    throw SDKError.invalidFormatMessage("Invalid value for imageUrlExpireTime, check the minute(s)")
                }
            case "h":
                if value < 0 || value > 24 {
                    throw SDKError.invalidFormatMessage("Invalid value for imageUrlExpireTime, check the hour(s)")
                }
            case "d":
                if value < 0 || value > 30 {
                    throw SDKError.invalidFormatMessage("Invalid value for imageUrlExpireTime, check the day(s)")
                }
            default:
                throw SDKError.invalidFormatMessage("Invalid value for imageUrlExpireTime, check the parameters")
            }
        }
    }
    
    var getImageUrlExpireTime: String? {
        imageUrlExpireTime
    }
}
